# Generated by Django 2.2.6 on 2019-12-30 05:10
from django.db import migrations
def migrate_code(apps, schema_editor):
ContentType = apps.get_model('contenttypes', 'ContentType')
Permission = apps.get_model('auth', 'Permission')
ModelClass = apps.get_model('app', 'Model')
ctype = ContentType.objects.get_for_model(ModelClass)
if not Permission.objects.filter(content_type=ctype, codename='perm_name').exists():
Permission.objects.create(
content_type=ctype,
codename='perm_name',
name='perm title'
)
class Migration(migrations.Migration):
dependencies = [
('', ''),
]
operations = [
migrations.RunPython(migrate_code, reverse_code=migrations.RunPython.noop)
]