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()
|
|
@ -57,7 +57,6 @@ class Area(models.Model):
|
|||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Road(models.Model):
|
||||
code = models.IntegerField()#primary_key=True)
|
||||
slug = models.SlugField(null=True)
|
||||
|
|
Loading…
Reference in New Issue
Block a user