On ajoute le droit d'appliquer les questions
This commit is contained in:
parent
219e72d2e6
commit
8fe71c841b
24
src/agenda_culturel/migrations/0045_auto_20240405_1941.py
Normal file
24
src/agenda_culturel/migrations/0045_auto_20240405_1941.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Generated by Django 4.2.7 on 2024-04-05 17:41
|
||||
|
||||
from django.db import migrations
|
||||
from django.contrib.auth.models import Group, Permission
|
||||
|
||||
def update_groups_permissions(apps, schema_editor):
|
||||
|
||||
all_perms = Permission.objects.all()
|
||||
|
||||
# set permissions for moderators
|
||||
mod_perms = [i for i in all_perms if i.content_type.app_label == 'agenda_culturel' and i.content_type.model == 'moderationquestion' and i.codename.startswith('use_')]
|
||||
Group.objects.get(name="Moderator").permissions.add(*mod_perms)
|
||||
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('agenda_culturel', '0044_alter_batchimportation_options_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(update_groups_permissions),
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user