Skip to content

Commit

Permalink
Improve slug existence handling
Browse files Browse the repository at this point in the history
  • Loading branch information
noirbizarre committed May 26, 2015
1 parent 952041b commit 8c9cab2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion udata/models/slug_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def populate_slug(instance, field):
if previous:
qs = qs(id__ne=previous.id)

exists = lambda s: qs(class_check=False, **{field.db_field: s}).count() > 0
exists = lambda s: qs(class_check=False, **{field.db_field: s}).limit(1).count(True) > 0
while exists(slug):
slug = '{0}-{1}'.format(base_slug, index)
index += 1
Expand Down

0 comments on commit 8c9cab2

Please sign in to comment.