diff --git a/club/migrations/0012_club_board_group_club_members_group.py b/club/migrations/0012_club_board_group_club_members_group.py index e436bcd4..a9ad8d3a 100644 --- a/club/migrations/0012_club_board_group_club_members_group.py +++ b/club/migrations/0012_club_board_group_club_members_group.py @@ -2,12 +2,15 @@ import django.db.models.deletion import django.db.models.functions.datetime -from django.conf import settings from django.db import migrations, models from django.db.migrations.state import StateApps from django.db.models import Q from django.utils.timezone import localdate +# Before the club role rework, the maximum free role +# was the hardcoded highest non-board role +MAXIMUM_FREE_ROLE = 1 + def migrate_meta_groups(apps: StateApps, schema_editor): """Attach the existing meta groups to the clubs. @@ -46,10 +49,7 @@ def migrate_meta_groups(apps: StateApps, schema_editor): ).select_related("user") club.members_group.users.set([m.user for m in memberships]) club.board_group.users.set( - [ - m.user - for m in memberships.filter(role__gt=settings.SITH_MAXIMUM_FREE_ROLE) - ] + [m.user for m in memberships.filter(role__gt=MAXIMUM_FREE_ROLE)] ) diff --git a/club/migrations/0015_clubrole_alter_membership_role.py b/club/migrations/0015_clubrole_alter_membership_role.py index 08431ea1..91056f03 100644 --- a/club/migrations/0015_clubrole_alter_membership_role.py +++ b/club/migrations/0015_clubrole_alter_membership_role.py @@ -1,12 +1,12 @@ # Generated by Django 5.2.3 on 2025-06-21 21:59 import django.db.models.deletion -from django.conf import settings from django.db import migrations, models from django.db.migrations.state import StateApps from django.db.models import Case, When PRESIDENT_ROLE = 10 +MAXIMUM_FREE_ROLE = 1 SITH_CLUB_ROLES = { 10: "Président⸱e", 9: "Vice-Président⸱e", @@ -28,7 +28,7 @@ def migrate_roles(apps: StateApps, schema_editor): for club_id, role in Membership.objects.values_list("club", "role").distinct(): new_role = ClubRole.objects.create( name=SITH_CLUB_ROLES[role], - is_board=role > settings.SITH_MAXIMUM_FREE_ROLE, + is_board=role > MAXIMUM_FREE_ROLE, is_presidency=role == PRESIDENT_ROLE, club_id=club_id, order=PRESIDENT_ROLE - role, diff --git a/sith/settings.py b/sith/settings.py index 6f7c02fc..f3ed911f 100644 --- a/sith/settings.py +++ b/sith/settings.py @@ -574,11 +574,6 @@ SITH_SUBSCRIPTIONS = { # To be completed.... } -# This corresponds to the maximum role a user can freely subscribe to -# In this case, SITH_MAXIMUM_FREE_ROLE=1 means that a user can -# set himself as "Membre actif" or "Curieux", but not higher -SITH_MAXIMUM_FREE_ROLE = 1 - # Minutes to timeout the logged barmen SITH_BARMAN_TIMEOUT = 30