##// END OF EJS Templates
Use native django auth for moderation
neko259 -
r811:af0a7a15 default
parent child Browse files
Show More
@@ -15,6 +15,8 b" CONTEXT_PPD = 'posts_per_day'"
15 CONTEXT_TAGS = 'tags'
15 CONTEXT_TAGS = 'tags'
16 CONTEXT_USER = 'user'
16 CONTEXT_USER = 'user'
17
17
18 PERMISSION_MODERATE = 'moderation'
19
18
20
19 def user_and_ui_processor(request):
21 def user_and_ui_processor(request):
20 context = {}
22 context = {}
@@ -28,10 +30,10 b' def user_and_ui_processor(request):'
28 context[CONTEXT_THEME_CSS] = 'css/' + theme + '/base_page.css'
30 context[CONTEXT_THEME_CSS] = 'css/' + theme + '/base_page.css'
29
31
30 # This shows the moderator panel
32 # This shows the moderator panel
31 moderate = settings_manager.has_permission(PERMISSION_MODERATE)
33 moderate = request.user.has_perm('moderation')
32 context[CONTEXT_MODERATOR] = moderate
34 context[CONTEXT_MODERATOR] = moderate
33
35
34 context[CONTEXT_VERSION] = settings.VERSION
36 context[CONTEXT_VERSION] = settings.VERSION
35 context[CONTEXT_SITE_NAME] = settings.SITE_NAME
37 context[CONTEXT_SITE_NAME] = settings.SITE_NAME
36
38
37 return context No newline at end of file
39 return context
@@ -46,12 +46,8 b''
46
46
47 <div class="navigation_panel">
47 <div class="navigation_panel">
48 {% block metapanel %}{% endblock %}
48 {% block metapanel %}{% endblock %}
49 {% if moderator %}
49 [<a href="{% url 'admin:index' %}">{% trans 'Admin' %}</a>]
50 [<a href="{% url "logout" %}">{% trans 'Logout' %}</a>]
50 [<a href="{% url 'search' %}">{% trans 'Search' %}</a>]
51 {% else %}
52 [<a href="{% url "login" %}">{% trans 'Login' %}</a>]
53 {% endif %}
54 [<a href="{% url "search" %}">{% trans 'Search' %}</a>]
55 {% with ppd=posts_per_day|floatformat:2 %}
51 {% with ppd=posts_per_day|floatformat:2 %}
56 {% blocktrans %}Speed: {{ ppd }} posts per day{% endblocktrans %}
52 {% blocktrans %}Speed: {{ ppd }} posts per day{% endblocktrans %}
57 {% endwith %}
53 {% endwith %}
@@ -1,8 +1,9 b''
1 from django.conf.urls import patterns, url, include
1 from django.conf.urls import patterns, url, include
2 from django.contrib import admin
2 from boards import views
3 from boards import views
3 from boards.rss import AllThreadsFeed, TagThreadsFeed, ThreadPostsFeed
4 from boards.rss import AllThreadsFeed, TagThreadsFeed, ThreadPostsFeed
4 from boards.views import api, tag_threads, all_threads, \
5 from boards.views import api, tag_threads, all_threads, \
5 login, settings, all_tags, logout
6 settings, all_tags
6 from boards.views.authors import AuthorsView
7 from boards.views.authors import AuthorsView
7 from boards.views.delete_post import DeletePostView
8 from boards.views.delete_post import DeletePostView
8 from boards.views.ban import BanUserView
9 from boards.views.ban import BanUserView
@@ -15,17 +16,12 b' js_info_dict = {'
15 }
16 }
16
17
17 urlpatterns = patterns('',
18 urlpatterns = patterns('',
18
19 # /boards/
19 # /boards/
20 url(r'^$', all_threads.AllThreadsView.as_view(), name='index'),
20 url(r'^$', all_threads.AllThreadsView.as_view(), name='index'),
21 # /boards/page/
21 # /boards/page/
22 url(r'^page/(?P<page>\w+)/$', all_threads.AllThreadsView.as_view(),
22 url(r'^page/(?P<page>\w+)/$', all_threads.AllThreadsView.as_view(),
23 name='index'),
23 name='index'),
24
24
25 # login page
26 url(r'^login/$', login.LoginView.as_view(), name='login'),
27 url(r'^logout/$', logout.LogoutView.as_view(), name='logout'),
28
29 # /boards/tag/tag_name/
25 # /boards/tag/tag_name/
30 url(r'^tag/(?P<tag_name>\w+)/$', tag_threads.TagView.as_view(),
26 url(r'^tag/(?P<tag_name>\w+)/$', tag_threads.TagView.as_view(),
31 name='tag'),
27 name='tag'),
@@ -10,15 +10,10 b' from boards.views.not_found import NotFo'
10 admin.autodiscover()
10 admin.autodiscover()
11
11
12 urlpatterns = patterns('',
12 urlpatterns = patterns('',
13 # Examples:
14 # url(r'^$', 'neboard.views.home', name='home'),
15 # url(r'^neboard/', include('neboard.foo.urls')),
16
17 # Uncomment the admin/doc line below to enable admin documentation:
13 # Uncomment the admin/doc line below to enable admin documentation:
18 # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
14 # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
19
15
20 # Uncomment the next line to enable the admin:
16 url(r'^admin/', include(admin.site.urls), name='admin'),
21 url(r'^admin/', include(admin.site.urls)),
22 url(r'^', include('boards.urls')),
17 url(r'^', include('boards.urls')),
23 ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
18 ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
24
19
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now