kopia lustrzana https://github.com/wagtail/wagtail
Make wagtailadmin migrations re-runnable
rodzic
56c85f8984
commit
9a3bfb8dac
|
@ -13,20 +13,20 @@ def create_admin_access_permissions(apps, schema_editor):
|
|||
# Add a fake content type to hang the 'can access Wagtail admin' permission off.
|
||||
# The fact that this doesn't correspond to an actual defined model shouldn't matter, I hope...
|
||||
if django.VERSION >= (1, 8):
|
||||
wagtailadmin_content_type = ContentType.objects.create(
|
||||
wagtailadmin_content_type, created = ContentType.objects.get_or_create(
|
||||
app_label='wagtailadmin',
|
||||
model='admin'
|
||||
)
|
||||
else:
|
||||
# Django 1.7 and below require a content type name
|
||||
wagtailadmin_content_type = ContentType.objects.create(
|
||||
wagtailadmin_content_type, created = ContentType.objects.get_or_create(
|
||||
app_label='wagtailadmin',
|
||||
model='admin',
|
||||
name='Wagtail admin'
|
||||
)
|
||||
|
||||
# Create admin permission
|
||||
admin_permission = Permission.objects.create(
|
||||
admin_permission, created = Permission.objects.get_or_create(
|
||||
content_type=wagtailadmin_content_type,
|
||||
codename='access_admin',
|
||||
name='Can access Wagtail admin'
|
||||
|
|
Ładowanie…
Reference in New Issue