add make_slugs script
This commit is contained in:
parent
eb75240f2e
commit
48580ad4be
11
chaloBEST/imports/make_slugs.py
Normal file
11
chaloBEST/imports/make_slugs.py
Normal 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()
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user