Disable creation of new slugs, since we should be updating them now.

refactor-builder
Eric Holscher 2014-01-09 00:44:49 -05:00
parent ceff35d872
commit dd594b6781
1 changed files with 2 additions and 0 deletions

View File

@ -94,12 +94,14 @@ def _custom_slugify(data):
def slugify_uniquely(model, initial, field, max_length, **filters):
slug = _custom_slugify(initial)[:max_length]
current = slug
"""
base_qs = model.objects.filter(**filters)
index = 0
while base_qs.filter(**{field: current}).exists():
suffix = '-%s' % index
current = '%s%s' % (slug, suffix)
index += 1
"""
return current