Skip to content

Instantly share code, notes, and snippets.

@renatooliveira
Created October 8, 2013 18:35
Show Gist options
  • Save renatooliveira/6889362 to your computer and use it in GitHub Desktop.
Save renatooliveira/6889362 to your computer and use it in GitHub Desktop.
class Tag(models.Model):
name = models.CharField(u'Tag', max_length=100)
post = models.ForeignKey(Post, related_name='tags')
slug = models.SlugField(u'Slug')
def get_absolute_url(self):
return reverse('posts.views.tag', kwargs={'slug': self.slug})
def __unicode__(self):
return unicode(self.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment