mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-27 01:54:49 +00:00
Fixed deprecation warning in admin migration
This commit is contained in:
parent
a679aa26d3
commit
6dfa1aad01
1 changed files with 13 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
|
@ -11,11 +12,18 @@ 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...
|
||||
wagtailadmin_content_type = ContentType.objects.create(
|
||||
app_label='wagtailadmin',
|
||||
model='admin',
|
||||
name='Wagtail admin'
|
||||
)
|
||||
if django.VERSION >= (1, 8):
|
||||
wagtailadmin_content_type = ContentType.objects.create(
|
||||
app_label='wagtailadmin',
|
||||
model='admin'
|
||||
)
|
||||
else:
|
||||
# Django 1.7 and below require a content type name
|
||||
wagtailadmin_content_type = ContentType.objects.create(
|
||||
app_label='wagtailadmin',
|
||||
model='admin',
|
||||
name='Wagtail admin'
|
||||
)
|
||||
|
||||
# Create admin permission
|
||||
admin_permission = Permission.objects.create(
|
||||
|
|
|
|||
Loading…
Reference in a new issue