summaryrefslogtreecommitdiff
path: root/news/urls.py
diff options
context:
space:
mode:
Diffstat (limited to 'news/urls.py')
-rw-r--r--news/urls.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/news/urls.py b/news/urls.py
index 10020f31..0eec6d86 100644
--- a/news/urls.py
+++ b/news/urls.py
@@ -1,14 +1,25 @@
from django.conf.urls import patterns
+from django.contrib.auth.decorators import permission_required
+from .views import (NewsDetailView, NewsListView,
+ NewsCreateView, NewsEditView, NewsDeleteView)
+
urlpatterns = patterns('news.views',
- (r'^$', 'news_list', {}, 'news-list'),
- (r'^add/$', 'add'),
- (r'^preview/$', 'preview'),
+ (r'^$',
+ NewsListView.as_view(), {}, 'news-list'),
+
+ (r'^preview/$', 'preview'),
# old news URLs, permanent redirect view so we don't break all links
- (r'^(?P<object_id>\d+)/$', 'view_redirect'),
- (r'^(?P<slug>[-\w]+)/$', 'view'),
- (r'^(?P<slug>[-\w]+)/edit/$', 'edit'),
- (r'^(?P<slug>[-\w]+)/delete/$', 'delete'),
+ (r'^(?P<object_id>\d+)/$', 'view_redirect'),
+
+ (r'^add/$',
+ permission_required('news.add_news')(NewsCreateView.as_view())),
+ (r'^(?P<slug>[-\w]+)/$',
+ NewsDetailView.as_view()),
+ (r'^(?P<slug>[-\w]+)/edit/$',
+ permission_required('news.change_news')(NewsEditView.as_view())),
+ (r'^(?P<slug>[-\w]+)/delete/$',
+ permission_required('news.delete_news')(NewsDeleteView.as_view())),
)
# vim: set ts=4 sw=4 et: