Reputation: 445
How can I use tags with whitespace char in their name with django-taggit? For example, "Some simple tag"? Because if I ctrl-c=>ctrl-v some phrase to tags field in my admin panel, on page with this tag i get something like this:
Reverse for 'posts_by_tag' with arguments '()' and keyword arguments '{u'tag':
u'\u0411\u0430\u043d\u043a \u0422\u0430\u0432\u0440\u0438\u043a\u0430'}'
not found. 1 pattern(s) tried: ['blog-list/posts/(?P<tag>\\w+)$']
, but if I try add tag with whitespace-it just cut on whitespace char and starts new tag. How can I fix it?
Upvotes: 0
Views: 428
Reputation: 101
Here is an instruction on how to do it - link
Create a file in the app folder "utils.py"
Insert code
def comma_splitter(tag_string):
return [t.strip().lower() for t in tag_string.split(',') if t.strip()]
TAGGIT_TAGS_FROM_STRING = 'appname.utils.comma_splitter'
Upvotes: 0
Reputation: 3867
Multi-word tags in Wagtail need to be quoted, e.g. "my tag".
There are two pull requests open that address this topic:
Upvotes: 1