Skip to content

Instantly share code, notes, and snippets.

@Alir3z4
Created March 30, 2012 15:17
Show Gist options
  • Save Alir3z4/2252222 to your computer and use it in GitHub Desktop.
Save Alir3z4/2252222 to your computer and use it in GitHub Desktop.
Slugify all the country.printable_name and put them in slug field
def forwards(self, orm):
"""
Slugify all the country.printable_name and put them in slug field
"""
from django.template.defaultfilters import slugify
for country in orm.Country.objects.all():
country.slug = slugify(country.printable_name)
countey.save()
def backwards(self, orm):
db.delete_column('datacenter_country', 'slug')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment