diff --git a/boards/forms.py b/boards/forms.py --- a/boards/forms.py +++ b/boards/forms.py @@ -332,7 +332,7 @@ class ThreadForm(PostForm): # If this is a new tag, don't check for its parents because nobody # added them yet if not created: - tag_set |= tag.get_all_parents() + tag_set |= set(tag.get_all_parents()) for tag in tag_set: if tag.required: @@ -340,7 +340,6 @@ class ThreadForm(PostForm): break if not required_tag_exists: - all_tags = Tag.objects.filter(required=True) raise forms.ValidationError( _('Need at least one section.')) diff --git a/boards/models/tag.py b/boards/models/tag.py --- a/boards/models/tag.py +++ b/boards/models/tag.py @@ -122,11 +122,11 @@ class Tag(models.Model, Viewable): return self.parent def get_all_parents(self): - parents = set() + parents = list() parent = self.get_parent() if parent and parent not in parents: - parents.add(parent) - parents |= parent.get_all_parents() + parents.insert(0, parent) + parents = parent.get_all_parents() + parents return parents diff --git a/boards/templates/boards/all_threads.html b/boards/templates/boards/all_threads.html --- a/boards/templates/boards/all_threads.html +++ b/boards/templates/boards/all_threads.html @@ -73,11 +73,11 @@
{{ tag.get_description|safe }}
{% endif %}{% blocktrans with active_thread_count=tag.get_active_thread_count thread_count=tag.get_thread_count post_count=tag.get_post_count %}This tag has {{ thread_count }} threads ({{ active_thread_count}} active) and {{ post_count }} posts.{% endblocktrans %}
- {% if tag.get_parent %} + {% if tag.get_all_parents %}- {% if tag.get_parent %} - {{ tag.get_parent.get_view|safe }} / - {% endif %} + {% for parent in tag.get_all_parents %} + {{ parent.get_view|safe }} > + {% endfor %} {{ tag.get_view|safe }}
{% endif %}