kopia lustrzana https://github.com/wagtail/wagtail
Use field.rel over field.related, rel.model over rel.to
rodzic
a9f1d23b9f
commit
2c0d3b477b
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue