Created
June 3, 2011 06:34
-
-
Save pagles/1005962 to your computer and use it in GitHub Desktop.
Using django taggit with custom tags
This file contains 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
class MyTag(TagBase): | |
def slugify(self, tag, i=None): | |
slug = slughifi(tag) | |
if i is not None: | |
slug += "_%d" % i | |
return slug | |
class Meta: | |
verbose_name = _("Tag") | |
verbose_name_plural = _("Tags") | |
class MyTagItem(GenericTaggedItemBase): | |
tag = models.ForeignKey(MyTag, related_name="items") | |
# Then in your models | |
tags = TaggableManager(through=MyTagItem) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment