Missing Permissions Migration here

This commit is contained in:
Joel Falknau 2025-03-05 12:07:25 +10:00
parent 5d4df417c2
commit 84cca59dd3
No known key found for this signature in database

View File

@ -5,6 +5,18 @@ import django.utils.timezone
from django.db import migrations, models
def create_permissions(apps, schema_editor):
User = apps.get_model('auth', 'User')
ContentType = apps.get_model('contenttypes', 'ContentType')
Permission = apps.get_model('auth', 'Permission')
ct = ContentType.objects.get_for_model(User)
Permission.objects.get_or_create(codename="srp_management", content_type=ct, name="srp_management")
def reverse(apps, schema_editor):
pass
class Migration(migrations.Migration):
replaces = [('srp', '0001_initial'), ('srp', '0002_srpuserrequest_srp_status_choices'), ('srp', '0003_make_strings_more_stringy'), ('srp', '0004_on_delete'), ('srp', '0005_alter_srpfleetmain_options')]
@ -49,4 +61,5 @@ class Migration(migrations.Migration):
('srp_fleet_main', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='srp.srpfleetmain')),
],
),
migrations.RunPython(create_permissions, reverse)
]