fix error with Location.get_child() in editor
This commit is contained in:
parent
5a034dc1fa
commit
38edfe4216
2 changed files with 3 additions and 3 deletions
|
@ -336,7 +336,7 @@ class ChangeSet(models.Model):
|
||||||
objects.setdefault(obj.__class__, {})[pk] = obj
|
objects.setdefault(obj.__class__, {})[pk] = obj
|
||||||
|
|
||||||
for pk, obj in objects.get(LocationRedirect, {}).items():
|
for pk, obj in objects.get(LocationRedirect, {}).items():
|
||||||
target = obj.target.get_child()
|
target = obj.target.get_child(obj.target)
|
||||||
objects.setdefault(LocationSlug, {})[target.pk] = target
|
objects.setdefault(LocationSlug, {})[target.pk] = target
|
||||||
objects.setdefault(target.__class__, {})[target.pk] = target
|
objects.setdefault(target.__class__, {})[target.pk] = target
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,10 @@ class LocationSlug(SerializableMixin, models.Model):
|
||||||
|
|
||||||
objects = LocationSlugManager()
|
objects = LocationSlugManager()
|
||||||
|
|
||||||
def get_child(self):
|
def get_child(self, instance=None):
|
||||||
for model in get_submodels(Location)+[LocationRedirect]:
|
for model in get_submodels(Location)+[LocationRedirect]:
|
||||||
with suppress(AttributeError):
|
with suppress(AttributeError):
|
||||||
return getattr(self, model._meta.default_related_name)
|
return getattr(instance or self, model._meta.default_related_name)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_slug(self):
|
def get_slug(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue