diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py
index 920737b..7c1f099 100644
--- a/core/migrations/0001_initial.py
+++ b/core/migrations/0001_initial.py
@@ -1,10 +1,11 @@
-# Generated by Django 5.2.8 on 2025-12-04 12:34
+# Generated by Django 5.2.8 on 2025-12-16 09:55
import django.contrib.auth.models
import django.contrib.auth.validators
import django.db.models.deletion
import django.utils.timezone
import pictures.models
+import uuid
from django.conf import settings
from django.db import migrations, models
@@ -21,7 +22,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Badge',
fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('uuid', models.UUIDField(default=uuid.uuid7, primary_key=True, serialize=False)),
('name', models.CharField(max_length=100, verbose_name='Nom')),
('icon_width', models.PositiveIntegerField(blank=True, editable=False, null=True)),
('icon_height', models.PositiveIntegerField(blank=True, editable=False, null=True)),
@@ -42,7 +43,6 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='User',
fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
@@ -53,6 +53,7 @@ class Migration(migrations.Migration):
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
+ ('uuid', models.UUIDField(default=uuid.uuid7, primary_key=True, serialize=False)),
('avatar_width', models.PositiveIntegerField(blank=True, editable=False, null=True)),
('avatar_height', models.PositiveIntegerField(blank=True, editable=False, null=True)),
('avatar', pictures.models.PictureField(aspect_ratios=[None, '1/1', '3/2'], blank=True, breakpoints={'l': 1200, 'm': 992, 's': 768, 'xl': 1400, 'xs': 576}, container_width=1200, file_types=['WEBP'], grid_columns=12, height_field='avatar_height', null=True, pixel_densities=[1, 2], upload_to='users/avatars/', verbose_name='Avatar', width_field='avatar_width')),
@@ -61,8 +62,8 @@ class Migration(migrations.Migration):
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
],
options={
- 'verbose_name': 'Profil utilisateur',
- 'verbose_name_plural': 'Profils utilisateurs',
+ 'verbose_name': 'Utilisateur',
+ 'verbose_name_plural': 'Utilisateurs',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
@@ -71,7 +72,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='BadgeHistory',
fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('uuid', models.UUIDField(default=uuid.uuid7, primary_key=True, serialize=False)),
('action', models.CharField(max_length=50, verbose_name='Action')),
('timestamp', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Date et heure')),
('details', models.TextField(blank=True, null=True, verbose_name='Détails')),
@@ -86,7 +87,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Structure',
fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('uuid', models.UUIDField(default=uuid.uuid7, primary_key=True, serialize=False)),
('name', models.CharField(max_length=100, verbose_name='Nom')),
('logo_width', models.PositiveIntegerField(blank=True, editable=False, null=True)),
('logo_height', models.PositiveIntegerField(blank=True, editable=False, null=True)),
@@ -121,7 +122,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='BadgeAssignment',
fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('uuid', models.UUIDField(default=uuid.uuid7, primary_key=True, serialize=False)),
('assigned_date', models.DateTimeField(default=django.utils.timezone.now, verbose_name="Date d'attribution")),
('notes', models.TextField(blank=True, null=True, verbose_name='Notes')),
('assigned_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='assigned_badges', to=settings.AUTH_USER_MODEL, verbose_name='Assigné par')),
@@ -138,7 +139,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='BadgeEndorsement',
fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('uuid', models.UUIDField(default=uuid.uuid7, primary_key=True, serialize=False)),
('endorsed_date', models.DateTimeField(default=django.utils.timezone.now, verbose_name="Date d'approbation")),
('notes', models.TextField(blank=True, null=True, verbose_name='Notes')),
('badge', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='endorsements', to='core.badge', verbose_name='Badge')),
diff --git a/core/models.py b/core/models.py
index 8ea7be9..5c6009e 100644
--- a/core/models.py
+++ b/core/models.py
@@ -1,3 +1,4 @@
+import uuid
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils import timezone
@@ -6,6 +7,9 @@
# Create your models here.
class User(AbstractUser):
+
+ uuid = models.UUIDField(default=uuid.uuid7, primary_key=True)
+
avatar_width = models.PositiveIntegerField(blank=True, null=True, editable=False)
avatar_height = models.PositiveIntegerField(blank=True, null=True, editable=False)
avatar = PictureField(upload_to='users/avatars/', blank=True, null=True, verbose_name="Avatar",
@@ -48,6 +52,9 @@ class Structure(models.Model):
"""
Model representing a structure (association, company, school, etc.)
"""
+
+ uuid = models.UUIDField(default=uuid.uuid7, primary_key=True)
+
TYPE_CHOICES = [
('association', 'Association'),
('company', 'Entreprise'),
@@ -95,6 +102,9 @@ class Badge(models.Model):
"""
Model representing a badge
"""
+
+ uuid = models.UUIDField(default=uuid.uuid7, primary_key=True)
+
LEVEL_CHOICES = [
('beginner', 'Débutant'),
('intermediate', 'Intermédiaire'),
@@ -168,6 +178,9 @@ class BadgeHistory(models.Model):
"""
Model to track the history of a badge (creation, modifications)
"""
+
+ uuid = models.UUIDField(default=uuid.uuid7, primary_key=True)
+
badge = models.ForeignKey(Badge, on_delete=models.CASCADE, related_name='history', verbose_name="Badge")
action = models.CharField(max_length=50, verbose_name="Action")
timestamp = models.DateTimeField(default=timezone.now, verbose_name="Date et heure")
@@ -186,6 +199,9 @@ class BadgeAssignment(models.Model):
"""
Model to track when a user receives a badge
"""
+
+ uuid = models.UUIDField(default=uuid.uuid7, primary_key=True)
+
badge = models.ForeignKey(Badge, on_delete=models.CASCADE, related_name='assignments', verbose_name="Badge")
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='badge_assignments', verbose_name="Utilisateur")
assigned_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True,
@@ -208,6 +224,9 @@ class BadgeEndorsement(models.Model):
"""
Model to track when a structure endorses a badge
"""
+
+ uuid = models.UUIDField(default=uuid.uuid7, primary_key=True)
+
badge = models.ForeignKey(Badge, on_delete=models.CASCADE, related_name='endorsements', verbose_name="Badge")
structure = models.ForeignKey(Structure, on_delete=models.CASCADE, related_name='endorsed_badges',
verbose_name="Structure")
diff --git a/core/urls.py b/core/urls.py
index c95d674..5005663 100644
--- a/core/urls.py
+++ b/core/urls.py
@@ -22,5 +22,5 @@
path('user/create/',views.UserViewSet.as_view({'get': 'create_user', 'post': 'create_user'}),name='create_user'),
# Edition routes
- path('users//edit', views.UserViewSet.as_view({'get': 'edit', 'post': 'edit'}), name='edit-profile')
+ path('users//edit', views.UserViewSet.as_view({'get': 'edit', 'post': 'edit'}), name='edit-profile')
]
diff --git a/core/views.py b/core/views.py
index 704165c..b68e2b9 100644
--- a/core/views.py
+++ b/core/views.py
@@ -16,8 +16,8 @@ class HomeViewSet(viewsets.ViewSet):
"""
def list(self, request):
# Get some recent badges and structures for the home page
- recent_badges = Badge.objects.all().order_by('-id')[:4]
- popular_structures = Structure.objects.all().order_by('-id')[:4]
+ recent_badges = Badge.objects.all().order_by('-pk')[:4]
+ popular_structures = Structure.objects.all().order_by('-pk')[:4]
return render(request, 'core/home/index.html', {
'title': 'FossBadge - Accueil',
diff --git a/templates/core/badges/list.html b/templates/core/badges/list.html
index be0861c..2d66e45 100644
--- a/templates/core/badges/list.html
+++ b/templates/core/badges/list.html
@@ -58,7 +58,7 @@ Filtres
Toutes les structures
{% for structure in structures %}
- {{ structure.name }}
+ {{ structure.name }}
{% endfor %}
@@ -93,7 +93,7 @@ {{ badge.name }}
{% endif %}
{{ badge.issuing_structure.name }}
- Voir le badge
+ Voir le badge
{% endfor %}
diff --git a/templates/core/badges/partials/badge_list.html b/templates/core/badges/partials/badge_list.html
index be04568..70da838 100644
--- a/templates/core/badges/partials/badge_list.html
+++ b/templates/core/badges/partials/badge_list.html
@@ -23,7 +23,7 @@ {{ badge.name }}
{% endif %}
{{ badge.issuing_structure.name }}
- Voir le badge
+ Voir le badge
{% endfor %}
diff --git a/templates/core/structures/detail.html b/templates/core/structures/detail.html
index 76978bd..82f4250 100644
--- a/templates/core/structures/detail.html
+++ b/templates/core/structures/detail.html
@@ -26,7 +26,7 @@ {{ structure.name }}
{% endif %}
{{ structure.name }}
- Forger un nouveau badge
+ Forger un nouveau badge
{% endfor %}
diff --git a/templates/core/structures/list.html b/templates/core/structures/list.html
index af6ec42..59107f2 100644
--- a/templates/core/structures/list.html
+++ b/templates/core/structures/list.html
@@ -58,7 +58,7 @@ Filtres
Tous les badges
{% for badge in badges %}
- {{ badge.name }}
+ {{ badge.name }}
{% endfor %}
@@ -89,7 +89,7 @@ {{ structure.name }}
{{ structure.description|truncatewords:30 }}
{{ structure.issued_badges.count }} badge{% if structure.issued_badges.count != 1 %}s{% endif %} disponible{% if structure.issued_badges.count != 1 %}s{% endif %}
-
Voir la structure
+
Voir la structure
diff --git a/templates/core/structures/partials/structure_list.html b/templates/core/structures/partials/structure_list.html
index 14828b0..8928ba4 100644
--- a/templates/core/structures/partials/structure_list.html
+++ b/templates/core/structures/partials/structure_list.html
@@ -19,7 +19,7 @@ {{ structure.name }}
{{ structure.description|truncatewords:30 }}
{{ structure.issued_badges.count }} badge{% if structure.issued_badges.count != 1 %}s{% endif %} disponible{% if structure.issued_badges.count != 1 %}s{% endif %}
-
Voir la structure
+
Voir la structure
diff --git a/templates/core/users/cv.html b/templates/core/users/cv.html
index 2d8b663..00b3555 100644
--- a/templates/core/users/cv.html
+++ b/templates/core/users/cv.html
@@ -457,7 +457,7 @@ Expérience
{% if badges %}
{% for badge in badges|slice:":5" %}
- {% with assignment=badge_assignment_dict|get_item:badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:badge.pk %}
{% if assignment %}
{{ badge.name }}
@@ -549,7 +549,7 @@ Structures visitées
{{ structure_group.list|length }} badge{% if structure_group.list|length > 1 %}s{% endif %}
{% with first_badge=structure_group.list.0 %}
- {% with assignment=badge_assignment_dict|get_item:first_badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:first_badge.pk %}
{% if assignment %}
Depuis {{ assignment.assigned_date|date:"M Y" }}
{% endif %}
@@ -614,7 +614,7 @@ Compétences supplémentaires
Expérience supplémentaire
{% for badge in badges|slice:"5:" %}
- {% with assignment=badge_assignment_dict|get_item:badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:badge.pk %}
{% if assignment %}
{{ badge.name }}
@@ -638,7 +638,7 @@ Structures visitées supplémentaires
{{ structure_group.list|length }} badge{% if structure_group.list|length > 1 %}s{% endif %}
{% with first_badge=structure_group.list.0 %}
- {% with assignment=badge_assignment_dict|get_item:first_badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:first_badge.pk %}
{% if assignment %}
Depuis {{ assignment.assigned_date|date:"M Y" }}
{% endif %}
diff --git a/templates/core/users/cv_bootstrap.html b/templates/core/users/cv_bootstrap.html
index 6bf0d6d..ee5d988 100644
--- a/templates/core/users/cv_bootstrap.html
+++ b/templates/core/users/cv_bootstrap.html
@@ -97,16 +97,16 @@
-
+
Retour au profil
-
+
Version classique
-
+
Version Material Design
-
+
Version Apple Liquid Glass
@@ -175,7 +175,7 @@ Expérience
{% if badges %}
{% for badge in badges|slice:":5" %}
- {% with assignment=badge_assignment_dict|get_item:badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:badge.pk %}
{% if assignment %}
{{ badge.name }}
@@ -303,7 +303,7 @@
{{ structure_group.grouper.name }}
{% with first_badge=structure_group.list.0 %}
- {% with assignment=badge_assignment_dict|get_item:first_badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:first_badge.pk %}
{% if assignment %}
Depuis {{ assignment.assigned_date|date:"M Y" }}
{% endif %}
@@ -387,7 +387,7 @@
Compétences
Expérience supplémentaire
{% for badge in badges|slice:"5:" %}
- {% with assignment=badge_assignment_dict|get_item:badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:badge.pk %}
{% if assignment %}
@@ -418,7 +418,7 @@
{{ structure_group.grouper.name }}
{% with first_badge=structure_group.list.0 %}
- {% with assignment=badge_assignment_dict|get_item:first_badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:first_badge.pk %}
{% if assignment %}
Depuis {{ assignment.assigned_date|date:"M Y" }}
{% endif %}
diff --git a/templates/core/users/cv_liquid_glass.html b/templates/core/users/cv_liquid_glass.html
index 34797a4..a558174 100644
--- a/templates/core/users/cv_liquid_glass.html
+++ b/templates/core/users/cv_liquid_glass.html
@@ -383,16 +383,16 @@
-
+
Retour au profil
-
+
Version classique
-
+
Version Bootstrap
-
+
Version Material Design
@@ -478,7 +478,7 @@ Expérience
{% if badges %}
{% for badge in badges|slice:":5" %}
- {% with assignment=badge_assignment_dict|get_item:badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:badge.pk %}
{% if assignment %}
@@ -620,7 +620,7 @@
{{ s
{{ structure_group.list|length }} badge{% if structure_group.list|length > 1 %}s{% endif %}
{% with first_badge=structure_group.list.0 %}
- {% with assignment=badge_assignment_dict|get_item:first_badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:first_badge.pk %}
{% if assignment %}
Depuis {{ assignment.assigned_date|date:"M Y" }}
{% endif %}
@@ -715,7 +715,7 @@
Expérience supplé
{% for badge in badges|slice:"5:" %}
- {% with assignment=badge_assignment_dict|get_item:badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:badge.pk %}
{% if assignment %}
@@ -745,7 +745,7 @@
{{ s
{{ structure_group.list|length }} badge{% if structure_group.list|length > 1 %}s{% endif %}
{% with first_badge=structure_group.list.0 %}
- {% with assignment=badge_assignment_dict|get_item:first_badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:first_badge.pk %}
{% if assignment %}
Depuis {{ assignment.assigned_date|date:"M Y" }}
{% endif %}
diff --git a/templates/core/users/cv_material.html b/templates/core/users/cv_material.html
index 1cbf2b2..e7edd74 100644
--- a/templates/core/users/cv_material.html
+++ b/templates/core/users/cv_material.html
@@ -283,16 +283,16 @@
-
+
Retour au profil
-
+
Version classique
-
+
Version Bootstrap
-
+
Version Apple Liquid Glass
@@ -378,7 +378,7 @@ Expérience
{% if badges %}
{% for badge in badges|slice:":5" %}
- {% with assignment=badge_assignment_dict|get_item:badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:badge.pk %}
{% if assignment %}
@@ -520,7 +520,7 @@
{{ structure_group.grouper
{{ structure_group.list|length }} badge{% if structure_group.list|length > 1 %}s{% endif %}
{% with first_badge=structure_group.list.0 %}
- {% with assignment=badge_assignment_dict|get_item:first_badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:first_badge.pk %}
{% if assignment %}
Depuis {{ assignment.assigned_date|date:"M Y" }}
{% endif %}
@@ -615,7 +615,7 @@
Expérience supplémen
{% for badge in badges|slice:"5:" %}
- {% with assignment=badge_assignment_dict|get_item:badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:badge.pk %}
{% if assignment %}
@@ -645,7 +645,7 @@
{{ structure_group.grouper
{{ structure_group.list|length }} badge{% if structure_group.list|length > 1 %}s{% endif %}
{% with first_badge=structure_group.list.0 %}
- {% with assignment=badge_assignment_dict|get_item:first_badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:first_badge.pk %}
{% if assignment %}
Depuis {{ assignment.assigned_date|date:"M Y" }}
{% endif %}
diff --git a/templates/core/users/detail.html b/templates/core/users/detail.html
index fd0ce06..47dd4f1 100644
--- a/templates/core/users/detail.html
+++ b/templates/core/users/detail.html
@@ -33,10 +33,10 @@
Voir mon CV
@@ -102,7 +102,7 @@
{{ badge.name }}
{{ badge.get_level_display }}
{% endif %}
- {% with assignment=badge_assignment_dict|get_item:badge.id %}
+ {% with assignment=badge_assignment_dict|get_item:badge.pk %}
{% if assignment %}
Assigné le {{ assignment.assigned_date|date:"d/m/Y" }}
@@ -110,7 +110,7 @@
{{ badge.name }}
{% endif %}
{% endwith %}
-
Voir le badge
+
Voir le badge
{% endfor %}
@@ -145,7 +145,7 @@
Mes structures
{% endif %}
{{ structure.name }}
-
Voir
+
Voir
{% endfor %}
{% else %}
diff --git a/templates/core/users/list.html b/templates/core/users/list.html
index 7242299..5424e6c 100644
--- a/templates/core/users/list.html
+++ b/templates/core/users/list.html
@@ -37,7 +37,7 @@
Filtres
Tous les badges
{% for badge in badges %}
- {{ badge.name }}
+ {{ badge.name }}
{% endfor %}
@@ -46,7 +46,7 @@ Filtres
Toutes les structures
{% for structure in structures %}
- {{ structure.name }}
+ {{ structure.name }}
{% endfor %}
@@ -122,7 +122,7 @@
Structures
diff --git a/templates/core/users/partials/user_list.html b/templates/core/users/partials/user_list.html
index 6caa371..a499027 100644
--- a/templates/core/users/partials/user_list.html
+++ b/templates/core/users/partials/user_list.html
@@ -40,7 +40,7 @@
Structures
diff --git a/templates/core/users/partials/user_profile_info.html b/templates/core/users/partials/user_profile_info.html
index 9f2d193..6b40810 100644
--- a/templates/core/users/partials/user_profile_info.html
+++ b/templates/core/users/partials/user_profile_info.html
@@ -6,7 +6,7 @@ Informations personnelles
Editer
diff --git a/templates/includes/footer.html b/templates/includes/footer.html
index af7f273..b8c5482 100644
--- a/templates/includes/footer.html
+++ b/templates/includes/footer.html
@@ -11,7 +11,6 @@
Liens rapides
diff --git a/templates/includes/menu.html b/templates/includes/menu.html
index 695f479..eec2623 100644
--- a/templates/includes/menu.html
+++ b/templates/includes/menu.html
@@ -13,9 +13,11 @@
Profils
+ {% comment %}
Mon Profil
+ {% endcomment %}
Badges
diff --git a/tests/core/test_badge_detail.py b/tests/core/test_badge_detail.py
index d22e73c..3682244 100644
--- a/tests/core/test_badge_detail.py
+++ b/tests/core/test_badge_detail.py
@@ -28,18 +28,18 @@ def setUp(self):
def test_badge_detail_page_loads_correctly(self):
"""Test that the badge detail page loads correctly with a 200 status code"""
- response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.id}))
+ response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.pk}))
self.assertEqual(response.status_code, 200)
def test_badge_detail_page_uses_correct_template(self):
"""Test that the badge detail page uses the correct template"""
- response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.id}))
+ response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.pk}))
self.assertTemplateUsed(response, 'core/badges/detail.html')
self.assertTemplateUsed(response, 'base.html')
def test_badge_detail_page_contains_expected_content(self):
"""Test that the badge detail page contains expected content"""
- response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.id}))
+ response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.pk}))
content = response.content.decode('utf-8')
# Check for badge detail specific content
@@ -56,6 +56,6 @@ def test_badge_name_change_is_reflected(self):
self.badge.save()
# Check that the new name is displayed
- response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.id}))
+ response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.pk}))
content = response.content.decode('utf-8')
self.assertIn(new_name, content)
\ No newline at end of file
diff --git a/tests/core/test_badge_search_filter.py b/tests/core/test_badge_search_filter.py
index bf2f998..1a71aa1 100644
--- a/tests/core/test_badge_search_filter.py
+++ b/tests/core/test_badge_search_filter.py
@@ -151,7 +151,7 @@ def test_badge_filter_by_level(self):
def test_badge_filter_by_structure(self):
"""Test filtering badges by structure"""
- response = self.client.get(reverse('core:badge-list') + f'?structure={self.structure1.id}')
+ response = self.client.get(reverse('core:badge-list') + f'?structure={self.structure1.pk}')
self.assertEqual(response.status_code, 200)
# Parse the HTML content
diff --git a/tests/core/test_create_badge.py b/tests/core/test_create_badge.py
index 0ef7961..381bddd 100644
--- a/tests/core/test_create_badge.py
+++ b/tests/core/test_create_badge.py
@@ -63,7 +63,7 @@ def test_create_badge_form_submission(self):
'name': 'Test Badge Created From Form',
'level': 'intermediate',
'description': 'This is a test badge created from the form submission test',
- 'issuing_structure': self.structure.id,
+ 'issuing_structure': self.structure.pk,
}
# Create a fresh test image for each test
diff --git a/tests/core/test_image_display.py b/tests/core/test_image_display.py
index c11c2e5..9cd7ddd 100644
--- a/tests/core/test_image_display.py
+++ b/tests/core/test_image_display.py
@@ -53,7 +53,7 @@ def setUp(self):
def test_structure_detail_page_displays_image(self):
"""Test that the structure detail page displays the structure logo using django-pictures"""
- response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.id}))
+ response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.pk}))
content = response.content.decode('utf-8')
# Check that the image is displayed using django-pictures (rendered HTML)
@@ -65,7 +65,7 @@ def test_structure_detail_page_displays_image(self):
def test_badge_detail_page_displays_image(self):
"""Test that the badge detail page displays the badge icon using django-pictures"""
- response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.id}))
+ response = self.client.get(reverse('core:badge-detail', kwargs={'pk': self.badge.pk}))
content = response.content.decode('utf-8')
# Check that the image is displayed using django-pictures (rendered HTML)
diff --git a/tests/core/test_structure_detail.py b/tests/core/test_structure_detail.py
index beacdbc..8280801 100644
--- a/tests/core/test_structure_detail.py
+++ b/tests/core/test_structure_detail.py
@@ -20,18 +20,18 @@ def setUp(self):
def test_structure_detail_page_loads_correctly(self):
"""Test that the structure detail page loads correctly with a 200 status code"""
- response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.id}))
+ response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.pk}))
self.assertEqual(response.status_code, 200)
def test_structure_detail_page_uses_correct_template(self):
"""Test that the structure detail page uses the correct template"""
- response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.id}))
+ response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.pk}))
self.assertTemplateUsed(response, 'core/structures/detail.html')
self.assertTemplateUsed(response, 'base.html')
def test_structure_detail_page_contains_expected_content(self):
"""Test that the structure detail page contains expected content"""
- response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.id}))
+ response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.pk}))
content = response.content.decode('utf-8')
# Check for structure detail specific content
@@ -49,6 +49,6 @@ def test_structure_name_change_is_reflected(self):
self.structure.save()
# Check that the new name is displayed
- response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.id}))
+ response = self.client.get(reverse('core:structure-detail', kwargs={'pk': self.structure.pk}))
content = response.content.decode('utf-8')
self.assertIn(new_name, content)
\ No newline at end of file
diff --git a/tests/core/test_user_profile.py b/tests/core/test_user_profile.py
index cd6da4b..3ea88b4 100644
--- a/tests/core/test_user_profile.py
+++ b/tests/core/test_user_profile.py
@@ -46,18 +46,18 @@ def setUp(self):
def test_user_profile_page_loads_correctly(self):
"""Test that the user profile page loads correctly with a 200 status code"""
- response = self.client.get(reverse('core:user-detail', kwargs={'pk': self.user.id}))
+ response = self.client.get(reverse('core:user-detail', kwargs={'pk': self.user.pk}))
self.assertEqual(response.status_code, 200)
def test_user_profile_page_uses_correct_template(self):
"""Test that the user profile page uses the correct template"""
- response = self.client.get(reverse('core:user-detail', kwargs={'pk': self.user.id}))
+ response = self.client.get(reverse('core:user-detail', kwargs={'pk': self.user.pk}))
self.assertTemplateUsed(response, 'core/users/detail.html')
self.assertTemplateUsed(response, 'base.html')
def test_user_profile_page_contains_expected_content(self):
"""Test that the user profile page contains expected content"""
- response = self.client.get(reverse('core:user-detail', kwargs={'pk': self.user.id}))
+ response = self.client.get(reverse('core:user-detail', kwargs={'pk': self.user.pk}))
content = response.content.decode('utf-8')
# Check for user profile specific content
@@ -68,7 +68,7 @@ def test_user_profile_page_contains_expected_content(self):
def test_user_profile_page_displays_badge_assignment_dates(self):
"""Test that the user profile page displays badge assignment dates correctly"""
- response = self.client.get(reverse('core:user-detail', kwargs={'pk': self.user.id}))
+ response = self.client.get(reverse('core:user-detail', kwargs={'pk': self.user.pk}))
content = response.content.decode('utf-8')
# Check that the badge is displayed