Skip to content

Commit

Permalink
fix permission abscense
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanbektashev committed Jun 2, 2023
1 parent b82c515 commit b048a3b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions accounts/migrations/0069_auto_20230602_1714.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Generated by Django 3.2.19 on 2023-06-02 14:14
from django.contrib.auth.management import create_permissions
from django.db import migrations


def ensure_permissions_exist(apps, schema_editor):
for app_config in apps.get_app_configs():
app_config.models_module = True
create_permissions(app_config, verbosity=0)
app_config.models_module = None


def update_moderator_permissions(apps, schema_editor):
Permission = apps.get_model('auth', 'Permission')
Group = apps.get_model('auth', 'Group')
Expand All @@ -17,5 +25,6 @@ class Migration(migrations.Migration):
]

operations = [
migrations.RunPython(ensure_permissions_exist, migrations.RunPython.noop, elidable=True),
migrations.RunPython(update_moderator_permissions, migrations.RunPython.noop, elidable=True)
]

0 comments on commit b048a3b

Please sign in to comment.