Show More
@@ -25,7 +25,7 b' class TagManager(models.Manager):' | |||||
25 | """ |
|
25 | """ | |
26 |
|
26 | |||
27 | return self.annotate(num_threads=Count('thread_tags')).filter(num_threads__gt=0)\ |
|
27 | return self.annotate(num_threads=Count('thread_tags')).filter(num_threads__gt=0)\ | |
28 |
.order_by(' |
|
28 | .order_by('name') | |
29 |
|
29 | |||
30 | def get_tag_url_list(self, tags: list) -> str: |
|
30 | def get_tag_url_list(self, tags: list) -> str: | |
31 | """ |
|
31 | """ |
@@ -176,7 +176,6 b'' | |||||
176 | </div> |
|
176 | </div> | |
177 | <div id="preview-text"></div> |
|
177 | <div id="preview-text"></div> | |
178 | <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div> |
|
178 | <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div> | |
179 | <div><a href="{% url "tags" "required" %}">{% trans 'Tags' %}</a></div> |
|
|||
180 | </div> |
|
179 | </div> | |
181 | </div> |
|
180 | </div> | |
182 |
|
181 |
@@ -41,7 +41,7 b'' | |||||
41 | </form> |
|
41 | </form> | |
42 | {{ tags_str|safe }}, |
|
42 | {{ tags_str|safe }}, | |
43 | {% endif %} |
|
43 | {% endif %} | |
44 |
<a href="{% url 'tags' |
|
44 | <a href="{% url 'tags' %}" title="{% trans 'Tag management' %}">{% trans "tags" %}</a>, | |
45 | <a href="{% url 'search' %}" title="{% trans 'Search' %}">{% trans 'search' %}</a>, |
|
45 | <a href="{% url 'search' %}" title="{% trans 'Search' %}">{% trans 'search' %}</a>, | |
46 | <a href="{% url 'feed' %}" title="{% trans 'Feed' %}">{% trans 'feed' %}</a>, |
|
46 | <a href="{% url 'feed' %}" title="{% trans 'Feed' %}">{% trans 'feed' %}</a>, | |
47 | <a href="{% url 'random' %}" title="{% trans 'Random images' %}">{% trans 'images' %}</a>{% if has_fav_threads %}, |
|
47 | <a href="{% url 'random' %}" title="{% trans 'Random images' %}">{% trans 'images' %}</a>{% if has_fav_threads %}, |
@@ -3,31 +3,16 b'' | |||||
3 | {% load i18n %} |
|
3 | {% load i18n %} | |
4 |
|
4 | |||
5 | {% block head %} |
|
5 | {% block head %} | |
6 |
<title> |
|
6 | <title>{{ site_name }} - {% trans "Tags" %}</title> | |
7 | {% endblock %} |
|
7 | {% endblock %} | |
8 |
|
8 | |||
9 | {% block content %} |
|
9 | {% block content %} | |
10 |
|
10 | |||
11 | {% regroup section_tags by get_first_letter as section_tag_list %} |
|
|||
12 | {% regroup all_tags by get_first_letter as other_tag_list %} |
|
11 | {% regroup all_tags by get_first_letter as other_tag_list %} | |
13 |
|
12 | |||
14 | <div class="post"> |
|
13 | <div class="post"> | |
15 | {% if section_tags %} |
|
|||
16 | <div> |
|
|||
17 | {% trans 'Sections:' %} |
|
|||
18 | {% for letter in section_tag_list %} |
|
|||
19 | <br />({{ letter.grouper|upper }}) |
|
|||
20 | {% for tag in letter.list %} |
|
|||
21 | {% autoescape off %} |
|
|||
22 | {{ tag.get_view }}{% if not forloop.last %},{% endif %} |
|
|||
23 | {% endautoescape %} |
|
|||
24 | {% endfor %} |
|
|||
25 | {% endfor %} |
|
|||
26 | </div> |
|
|||
27 | {% endif %} |
|
|||
28 | {% if all_tags %} |
|
14 | {% if all_tags %} | |
29 | <div> |
|
15 | <div> | |
30 | {% trans 'Other tags:' %} |
|
|||
31 | {% for letter in other_tag_list %} |
|
16 | {% for letter in other_tag_list %} | |
32 | <br />({{ letter.grouper|upper }}) |
|
17 | <br />({{ letter.grouper|upper }}) | |
33 | {% for tag in letter.list %} |
|
18 | {% for tag in letter.list %} | |
@@ -38,10 +23,6 b'' | |||||
38 | {% endfor %} |
|
23 | {% endfor %} | |
39 | </div> |
|
24 | </div> | |
40 | {% endif %} |
|
25 | {% endif %} | |
41 |
|
||||
42 | {% if query %} |
|
|||
43 | <div><a href="{% url 'tags' %}">{% trans 'All tags...' %}</a></div> |
|
|||
44 | {% endif %} |
|
|||
45 | </div> |
|
26 | </div> | |
46 |
|
27 | |||
47 | {% endblock %} |
|
28 | {% endblock %} |
@@ -42,7 +42,7 b' urlpatterns = [' | |||||
42 |
|
42 | |||
43 | url(r'^settings/$', settings.SettingsView.as_view(), name='settings'), |
|
43 | url(r'^settings/$', settings.SettingsView.as_view(), name='settings'), | |
44 | url(r'^aliases/(?P<category>\w+)/$', alias.AliasesView.as_view(), name='aliases'), |
|
44 | url(r'^aliases/(?P<category>\w+)/$', alias.AliasesView.as_view(), name='aliases'), | |
45 |
url(r'^tags/ |
|
45 | url(r'^tags/$', all_tags.AllTagsView.as_view(), name='tags'), | |
46 | url(r'^authors/$', AuthorsView.as_view(), name='authors'), |
|
46 | url(r'^authors/$', AuthorsView.as_view(), name='authors'), | |
47 |
|
47 | |||
48 | url(r'^banned/$', views.banned.BannedView.as_view(), name='banned'), |
|
48 | url(r'^banned/$', views.banned.BannedView.as_view(), name='banned'), |
@@ -4,20 +4,14 b' from boards.views.base import BaseBoardV' | |||||
4 | from boards.models.tag import Tag |
|
4 | from boards.models.tag import Tag | |
5 |
|
5 | |||
6 |
|
6 | |||
7 | PARAM_SECTION_TAGS = 'section_tags' |
|
|||
8 | PARAM_TAGS = 'all_tags' |
|
7 | PARAM_TAGS = 'all_tags' | |
9 | PARAM_QUERY = 'query' |
|
|||
10 |
|
8 | |||
11 |
|
9 | |||
12 | class AllTagsView(BaseBoardView): |
|
10 | class AllTagsView(BaseBoardView): | |
13 |
|
11 | |||
14 |
def get(self, request |
|
12 | def get(self, request): | |
15 | params = dict() |
|
13 | params = dict() | |
16 |
|
14 | |||
17 |
params[PARAM_ |
|
15 | params[PARAM_TAGS] = Tag.objects.get_not_empty_tags() | |
18 | if query != 'required': |
|
|||
19 | params[PARAM_TAGS] = Tag.objects.get_not_empty_tags().filter( |
|
|||
20 | required=False) |
|
|||
21 | params[PARAM_QUERY] = query |
|
|||
22 |
|
16 | |||
23 | return render(request, 'boards/tags.html', params) |
|
17 | return render(request, 'boards/tags.html', params) |
General Comments 0
You need to be logged in to leave comments.
Login now