Don't allow empty tags
@@ -16,6 +16,7 @@ def rtd_parse_tags(tag_string):
- Lowercases all tags
- Converts underscores to hyphens
- Slugifies tags
+ - Removes empty tags
:see: https://django-taggit.readthedocs.io/page/custom_tagging.html
:param tag_string: a delimited string of tags
@@ -24,7 +25,8 @@ def rtd_parse_tags(tag_string):
if tag_string:
tag_string = tag_string.lower().replace('_', '-')
- return sorted([slugify(tag) for tag in _parse_tags(tag_string)])
+ tags = [slugify(tag) for tag in _parse_tags(tag_string)]
+ return sorted([tag for tag in tags if tag])
def remove_unused_tags():
