1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00
webvirtcloud/admin/migrations/0003_create_group_technicians.py
catborise 8b1df3ab09 fix(admin): the Technicians group migration can run on a database that has it
It created the group with objects.create and had no reverse: it failed
when the group existed and could not be unapplied. It now uses
get_or_create, and its reverse does nothing.
2026-11-06 11:01:58 +03:00

17 lines
388 B
Python

from django.db import migrations
def apply_migration(apps, schema_editor):
Group = apps.get_model("auth", "Group")
Group.objects.get_or_create(name="Technicians")
class Migration(migrations.Migration):
dependencies = [
("admin", "0002_auto_20200609_0830"),
]
operations = [
migrations.RunPython(apply_migration, migrations.RunPython.noop),
]