fix changeset view with deleted location redirects & improve joins
This commit is contained in:
parent
cf39589619
commit
200603a1f0
3 changed files with 21 additions and 5 deletions
|
@ -17,6 +17,14 @@ class LocationSlugManager(models.Manager):
|
|||
for model in get_submodels(Location)+[LocationRedirect]))
|
||||
return result
|
||||
|
||||
def select_related_target(self):
|
||||
if self.model != LocationSlug:
|
||||
raise TypeError
|
||||
qs = self.get_queryset()
|
||||
qs = qs.select_related('redirect__target', *('redirect__target__'+model._meta.default_related_name
|
||||
for model in get_submodels(Location) + [LocationRedirect]))
|
||||
return qs
|
||||
|
||||
|
||||
class LocationSlug(SerializableMixin, models.Model):
|
||||
LOCATION_TYPE_CODES = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue