fix error when there are no slugs in the current changeset
This commit is contained in:
parent
dc116bd2fe
commit
f5c234ce34
1 changed files with 2 additions and 1 deletions
|
@ -219,7 +219,8 @@ class ChangeSet(models.Model):
|
||||||
slugs.add(slug)
|
slugs.add(slug)
|
||||||
|
|
||||||
qs = LocationSlug.objects.filter(slug__in=slugs)
|
qs = LocationSlug.objects.filter(slug__in=slugs)
|
||||||
qs = qs.filter(reduce(operator.or_, (Q(slug__startswith=slug+'__') for slug in slugs)))
|
if slugs:
|
||||||
|
qs = qs.filter(reduce(operator.or_, (Q(slug__startswith=slug+'__') for slug in slugs)))
|
||||||
existing_slugs = dict(qs.values_list('slug', 'redirect__target_id'))
|
existing_slugs = dict(qs.values_list('slug', 'redirect__target_id'))
|
||||||
|
|
||||||
slug_length = LocationSlug._meta.get_field('slug').max_length
|
slug_length = LocationSlug._meta.get_field('slug').max_length
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue