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

pull/2392/merge
Tim Heap 2016-03-23 17:24:27 +11:00 zatwierdzone przez Karl Hobley
rodzic a9f1d23b9f
commit 2c0d3b477b
2 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -484,7 +484,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:

Wyświetl plik

@ -41,7 +41,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