Remove Django 1.1 compatibility switch
parent
fed810b336
commit
ff22332d2c
|
|
@ -17,7 +17,6 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django import VERSION as django_VERSION
|
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
from .base import PolymorphicModelBase
|
from .base import PolymorphicModelBase
|
||||||
|
|
@ -57,13 +56,8 @@ class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)):
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
# avoid ContentType related field accessor clash (an error emitted by model validation)
|
# avoid ContentType related field accessor clash (an error emitted by model validation)
|
||||||
# we really should use both app_label and model name, but this is only possible since Django 1.2
|
|
||||||
if django_VERSION[0] <= 1 and django_VERSION[1] <= 1:
|
|
||||||
p_related_name_template = 'polymorphic_%(class)s_set'
|
|
||||||
else:
|
|
||||||
p_related_name_template = 'polymorphic_%(app_label)s.%(class)s_set'
|
|
||||||
polymorphic_ctype = models.ForeignKey(ContentType, null=True, editable=False,
|
polymorphic_ctype = models.ForeignKey(ContentType, null=True, editable=False,
|
||||||
related_name=p_related_name_template)
|
related_name='polymorphic_%(app_label)s.%(class)s_set')
|
||||||
|
|
||||||
# some applications want to know the name of the fields that are added to its models
|
# some applications want to know the name of the fields that are added to its models
|
||||||
polymorphic_internal_model_fields = ['polymorphic_ctype']
|
polymorphic_internal_model_fields = ['polymorphic_ctype']
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue