update slug script to ensure unique / ugly hack
This commit is contained in:
parent
c1aedefbc7
commit
974a57ee1a
|
@ -4,7 +4,10 @@ from mumbai.models import *
|
|||
def do():
|
||||
for cls in [Road, Area, Stop]:
|
||||
for obj in cls.objects.all():
|
||||
obj.slug = slugify(obj.display_name)
|
||||
slug = slugify(obj.display_name)
|
||||
if cls.objects.filter(slug=slug).count() > 1:
|
||||
slug += "2"
|
||||
obj.slug = slug
|
||||
obj.save()
|
||||
for r in Route.objects.all():
|
||||
r.slug = r.alias
|
||||
|
|
Loading…
Reference in New Issue
Block a user