Use field.rel over field.related, rel.model over rel.to

This commit is contained in:
Tim Heap 2016-03-23 17:24:27 +11:00 committed by Karl Hobley
parent c92ed903c6
commit 90bcabd9cd
2 changed files with 2 additions and 2 deletions

View file

@ -486,7 +486,7 @@ class BaseChooserPanel(BaseFieldPanel):
def get_chosen_item(self):
field = self.instance._meta.get_field(self.field_name)
related_model = field.related.model
related_model = field.rel.model
try:
return getattr(self.instance, self.field_name)
except related_model.DoesNotExist:

View file

@ -40,7 +40,7 @@ class BaseSnippetChooserPanel(BaseChooserPanel):
.format(cls.__name__, cls.snippet_type)
)
else:
cls._target_model = cls.model._meta.get_field(cls.field_name).rel.to
cls._target_model = cls.model._meta.get_field(cls.field_name).rel.model
return cls._target_model