Created
March 1, 2012 04:46
-
-
Save rwmyers/1947346 to your computer and use it in GitHub Desktop.
AutoSlugField Model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| from autoslug import AutoSlugField | |
| class Post(models.Model): | |
| title = models.CharField(max_length=120, unique=True) | |
| slug = AutoSlugField(populate_from='title', max_length=50, unique=True) | |
| body = models.CharField() | |
| posted = models.DateField(auto_now=True) | |
| def __unicode__(self): | |
| return self.title |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment