Slugfield on Django
Want a slug field on your model with some magic and no worries?
class Entry(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField()
Talking about Django and the baked admin, that's easy peasy:
class AdminEntries(admin.ModelAdmin):
prepopulated_fields = { 'slug': ['title'] }
And you know, every time you fill the title you will get the slug for free!
Written by Oscar M.
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Related Tags
#django
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#