##// END OF EJS Templates
Show all tag parents at the tag page
neko259 -
r1361:1af05638 default
parent child Browse files
Show More
@@ -332,7 +332,7 b' class ThreadForm(PostForm):'
332 # If this is a new tag, don't check for its parents because nobody
332 # If this is a new tag, don't check for its parents because nobody
333 # added them yet
333 # added them yet
334 if not created:
334 if not created:
335 tag_set |= tag.get_all_parents()
335 tag_set |= set(tag.get_all_parents())
336
336
337 for tag in tag_set:
337 for tag in tag_set:
338 if tag.required:
338 if tag.required:
@@ -340,7 +340,6 b' class ThreadForm(PostForm):'
340 break
340 break
341
341
342 if not required_tag_exists:
342 if not required_tag_exists:
343 all_tags = Tag.objects.filter(required=True)
344 raise forms.ValidationError(
343 raise forms.ValidationError(
345 _('Need at least one section.'))
344 _('Need at least one section.'))
346
345
@@ -122,11 +122,11 b' class Tag(models.Model, Viewable):'
122 return self.parent
122 return self.parent
123
123
124 def get_all_parents(self):
124 def get_all_parents(self):
125 parents = set()
125 parents = list()
126 parent = self.get_parent()
126 parent = self.get_parent()
127 if parent and parent not in parents:
127 if parent and parent not in parents:
128 parents.add(parent)
128 parents.insert(0, parent)
129 parents |= parent.get_all_parents()
129 parents = parent.get_all_parents() + parents
130
130
131 return parents
131 return parents
132
132
@@ -73,11 +73,11 b''
73 <p>{{ tag.get_description|safe }}</p>
73 <p>{{ tag.get_description|safe }}</p>
74 {% endif %}
74 {% endif %}
75 <p>{% 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 %}</p>
75 <p>{% 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 %}</p>
76 {% if tag.get_parent %}
76 {% if tag.get_all_parents %}
77 <p>
77 <p>
78 {% if tag.get_parent %}
78 {% for parent in tag.get_all_parents %}
79 {{ tag.get_parent.get_view|safe }} /
79 {{ parent.get_view|safe }} &gt;
80 {% endif %}
80 {% endfor %}
81 {{ tag.get_view|safe }}
81 {{ tag.get_view|safe }}
82 </p>
82 </p>
83 {% endif %}
83 {% endif %}
General Comments 0
You need to be logged in to leave comments. Login now