Quantcast
Channel: Peter of the Norse Thinks He’s Smarter than You
Viewing all articles
Browse latest Browse all 54

Tagging in Django

$
0
0

The last time I talked about tags in Django, there was only one game in town: Django-tagging. Now there is Django-taggit. It does (almost) everything right: A relation manager is used, which shows up in forms and the admin site. A slug is included. And it prefers commas to spaces as a delimiter. However, it wants to be user compatible with Django-tagging, so spaces can be used. Fortunately, that’s a simple problem to fix. I replaced the parse_tags and edit_string_for_tags functions, and it works great. Also, it’s case sensitive. I replaced the appropriate code so that it matches on the slug instead of the name. This has the added benefit of knowing that ‘hip hop’ and ‘hip-hop’ are the same thing.

You might not want to go that far, but if you’re using tags in Django, you should take a look at Django-taggit. It’s tagging done right.


Viewing all articles
Browse latest Browse all 54

Trending Articles