feat(django 1.9): ManyToOneRel.related renamed to .rel

pull/1990/merge
Karl Hobley 2015-10-12 16:34:22 +01:00 zatwierdzone przez Matt Westcott
rodzic 2f4018c0ae
commit ab6ac13f2c
2 zmienionych plików z 12 dodań i 3 usunięć

Wyświetl plik

@ -4,6 +4,7 @@ import copy
from modelcluster.forms import ClusterForm, ClusterFormMetaclass
import django
from django.db import models
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
@ -707,10 +708,15 @@ class InlinePanel(object):
self.max_num = max_num
def bind_to_model(self, model):
if django.VERSION >= (1, 9):
related = getattr(model, self.relation_name).rel
else:
related = getattr(model, self.relation_name).related
return type(str('_InlinePanel'), (BaseInlinePanel,), {
'model': model,
'relation_name': self.relation_name,
'related': getattr(model, self.relation_name).related,
'related': related,
'panels': self.panels,
'heading': self.label,
'help_text': self.help_text,

Wyświetl plik

@ -5,10 +5,10 @@ import hashlib
from contextlib import contextmanager
from collections import OrderedDict
from taggit.managers import TaggableManager
from willow.image import Image as WillowImage
import django
from django.core.files import File
from django.core.exceptions import ImproperlyConfigured
from django.db import models
@ -226,7 +226,10 @@ class AbstractImage(models.Model, TagSearchable):
@classmethod
def get_rendition_model(cls):
""" Get the Rendition model for this Image model """
return get_related_model(cls.renditions.related)
if django.VERSION >= (1, 9):
return get_related_model(cls.renditions.rel)
else:
return get_related_model(cls.renditions.related)
def get_rendition(self, filter):
if isinstance(filter, string_types):