django-smart-slug

A smart slug field for your models
Download

django-smart-slug Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Charles Leifer
  • Publisher web site:
  • http://www.charlesleifer.com/blog/

django-smart-slug Tags


django-smart-slug Description

A smart slug field for your models django-smart-slug is a Django app that provides slug fields for the lazy.ExamplesThere are exhausting examples in the tests, but here's the quick rundown:from django.db import modelsfrom smart_slug.fields import SmartSlugFieldclass Simple(models.Model): slug = SmartSlugField(max_length=5, underscores=False)class Complex(models.Model): title = models.CharField(max_length=100) slug = SmartSlugField( source_field='title', date_field='pub_date', split_on_words=True, max_length=10) pub_date = models.DateTimeField(auto_now=True)>>> s1 = Simple.objects.create(slug='simple')>>> s1.slugsimpl>>> s2 = Simple.objects.create(slug='simple')>>> s2.slugsim-1>>> s3 = Simple.objects.create(slug='simple')>>> s3.slugsim-2>>> c1 = Complex.objects.create(title='complex example')>>> c1.slugcomplex>>> c2 = Complex.objects.create(title='complex example')>>> c2.slugcomplex_ Requirements: · Python · Django


django-smart-slug Related Software