add make_slugs script

This commit is contained in:
Sanj 2012-02-19 18:37:11 +05:30
parent eb75240f2e
commit 48580ad4be
2 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,11 @@
from django.template.defaultfilters import slugify
from mumbai.models import *
def do():
for cls in [Road, Area, Stop]:
for obj in cls.objects.all():
obj.slug = slugify(obj.display_name)
obj.save()
for r in Route.objects.all():
r.slug = r.alias
r.save()

View File

@ -56,7 +56,6 @@ class Area(models.Model):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
class Road(models.Model): class Road(models.Model):
code = models.IntegerField()#primary_key=True) code = models.IntegerField()#primary_key=True)