Fixed deprecation warning in admin migration

This commit is contained in:
Karl Hobley 2015-04-02 13:33:54 +01:00
parent a679aa26d3
commit 6dfa1aad01

View file

@ -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(