Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

auto slug field django

from django.utils.text import slugify

class Brand(models.Model):
...

def save(self, *args, **kwargs):
    self.slug = slugify(self.brand_name)
    super(Brand, self).save(*args, **kwargs)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #auto #slug #field #django
ADD COMMENT
Topic
Name
9+7 =