fix error with Location.get_child() in editor

This commit is contained in:
Laura Klünder 2017-12-24 13:23:19 +01:00
parent 5a034dc1fa
commit 38edfe4216
2 changed files with 3 additions and 3 deletions

View file

@ -46,10 +46,10 @@ class LocationSlug(SerializableMixin, models.Model):
objects = LocationSlugManager()
def get_child(self):
def get_child(self, instance=None):
for model in get_submodels(Location)+[LocationRedirect]:
with suppress(AttributeError):
return getattr(self, model._meta.default_related_name)
return getattr(instance or self, model._meta.default_related_name)
return None
def get_slug(self):