mirror of https://github.com/snachodog/mybuddy.git
fix: add reverse operation for data migration
This commit is contained in:
parent
84d14c3410
commit
6992ddc911
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 4.1.2 on 2022-10-23 07:59
|
||||
# Generated by Django 4.1.2 on 2022-10-23 08:21
|
||||
|
||||
from django.db import migrations
|
||||
from django.contrib.auth.models import Group, Permission
|
||||
|
@ -60,10 +60,19 @@ def add_group_permissions(apps, schema_editor):
|
|||
group.permissions.add(*perm)
|
||||
|
||||
|
||||
def revert_migration(apps, schema_editor):
|
||||
Group.objects.filter(
|
||||
name__in=[
|
||||
"read_only",
|
||||
"standard",
|
||||
]
|
||||
).delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("babybuddy", "0023_alter_settings_timezone"),
|
||||
]
|
||||
|
||||
operations = [migrations.RunPython(add_group_permissions)]
|
||||
operations = [migrations.RunPython(add_group_permissions, revert_migration)]
|
Loading…
Reference in New Issue