Don't set ContentType.name on Django 1.8+

This is now a property rather than a field
This commit is contained in:
Karl Hobley 2015-03-15 11:33:49 +00:00 committed by Matt Westcott
parent 464dbc9ae2
commit 944017d2c0
3 changed files with 6 additions and 3 deletions

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import VERSION as DJANGO_VERSION
from django.db import migrations
@ -15,7 +16,7 @@ def initial_data(apps, schema_editor):
page_content_type, created = ContentType.objects.get_or_create(
model='page',
app_label='wagtailcore',
defaults={'name': 'page'}
defaults={'name': 'page'} if DJANGO_VERSION < (1, 8) else {}
)
# Create root page

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import VERSION as DJANGO_VERSION
from django.db import migrations
@ -13,7 +14,7 @@ def add_document_permissions_to_admin_groups(apps, schema_editor):
document_content_type, _created = ContentType.objects.get_or_create(
model='document',
app_label='wagtaildocs',
defaults={'name': 'document'}
defaults={'name': 'document'} if DJANGO_VERSION < (1, 8) else {}
)
add_document_permission, _created = Permission.objects.get_or_create(

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import VERSION as DJANGO_VERSION
from django.db import migrations
@ -13,7 +14,7 @@ def add_image_permissions_to_admin_groups(apps, schema_editor):
image_content_type, _created = ContentType.objects.get_or_create(
model='image',
app_label='wagtailimages',
defaults={'name': 'image'}
defaults={'name': 'image'} if DJANGO_VERSION < (1, 8) else {}
)
add_image_permission, _created = Permission.objects.get_or_create(