##// END OF EJS Templates
Added attachment alias categories
neko259 -
r1701:99ec870f default
parent child Browse files
Show More
@@ -0,0 +1,17 b''
1 {% extends "boards/base.html" %}
2
3 {% load i18n %}
4 {% load tz %}
5
6 {% block head %}
7 <meta name="robots" content="noindex">
8 <title>{% trans 'Aliases' %} - {{ site_name }}</title>
9 {% endblock %}
10
11 {% block content %}
12 <div class="post">
13 {% for image in image_aliases %}
14 <div>{{ image.alias }}: {{ image.get_view|safe }}</div>
15 {% endfor %}
16 </div>
17 {% endblock %}
@@ -0,0 +1,32 b''
1 from django.db import transaction
2 from django.shortcuts import render, redirect
3 from django.utils import timezone
4 from django.utils.decorators import method_decorator
5 from django.views.decorators.csrf import csrf_protect
6
7 from boards.abstracts.settingsmanager import get_settings_manager, \
8 SETTING_USERNAME, SETTING_LAST_NOTIFICATION_ID, SETTING_IMAGE_VIEWER
9 from boards.middlewares import SESSION_TIMEZONE
10 from boards.views.base import BaseBoardView, CONTEXT_FORM
11 from boards.forms import SettingsForm, PlainErrorList
12 from boards import settings
13 from boards.models import Attachment
14
15 CONTEXT_IMAGE_ALIASES = 'image_aliases'
16
17 TEMPLATE = 'boards/aliases.html'
18
19
20 class AliasesView(BaseBoardView):
21 @method_decorator(csrf_protect)
22 def get(self, request, category):
23 params = dict()
24 settings_manager = get_settings_manager(request)
25
26 selected_theme = settings_manager.get_theme()
27
28 params[CONTEXT_IMAGE_ALIASES] = Attachment.objects.exclude(alias='')\
29 .exclude(alias=None).filter(alias__startswith=(category + '/'))
30
31 return render(request, TEMPLATE, params)
32
@@ -24,10 +24,6 b''
24 24 {% else %}
25 25 <p>{% trans 'No hidden tags.' %}</p>
26 26 {% endif %}
27
28 {% for image in image_aliases %}
29 <div>{{ image.alias }}: {{ image.get_view|safe }}</div>
30 {% endfor %}
31 27 </div>
32 28
33 29 <div class="post-form-w">
@@ -5,7 +5,7 b' import neboard'
5 5 from boards import views
6 6 from boards.rss import AllThreadsFeed, TagThreadsFeed, ThreadPostsFeed
7 7 from boards.views import api, tag_threads, all_threads, \
8 settings, all_tags, feed
8 settings, all_tags, feed, alias
9 9 from boards.views.authors import AuthorsView
10 10 from boards.views.notifications import NotificationView
11 11 from boards.views.static import StaticPageView
@@ -39,6 +39,7 b' urlpatterns = ['
39 39 url(r'^feed/$', views.feed.FeedView.as_view(), name='feed'),
40 40
41 41 url(r'^settings/$', settings.SettingsView.as_view(), name='settings'),
42 url(r'^aliases/(?P<category>\w+)/$', alias.AliasesView.as_view(), name='aliases'),
42 43 url(r'^tags/(?P<query>\w+)?/?$', all_tags.AllTagsView.as_view(), name='tags'),
43 44 url(r'^authors/$', AuthorsView.as_view(), name='authors'),
44 45
@@ -18,7 +18,6 b" FORM_TIMEZONE = 'timezone'"
18 18 FORM_IMAGE_VIEWER = 'image_viewer'
19 19
20 20 CONTEXT_HIDDEN_TAGS = 'hidden_tags'
21 CONTEXT_IMAGE_ALIASES = 'image_aliases'
22 21
23 22 TEMPLATE = 'boards/settings.html'
24 23
@@ -45,7 +44,6 b' class SettingsView(BaseBoardView):'
45 44
46 45 params[CONTEXT_FORM] = form
47 46 params[CONTEXT_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
48 params[CONTEXT_IMAGE_ALIASES] = Attachment.objects.exclude(alias='').exclude(alias=None)
49 47
50 48 return render(request, TEMPLATE, params)
51 49
General Comments 0
You need to be logged in to leave comments. Login now