comparison news/urls.py @ 180:312f198e8958

Changes for Django 1.8.
author Brian Neal <bgneal@gmail.com>
date Sun, 13 Dec 2015 21:04:43 -0600
parents e2868ad47a1e
children
comparison
equal deleted inserted replaced
179:574cdd0241af 180:312f198e8958
1 """ 1 """
2 Urls for the news application. 2 Urls for the news application.
3 3
4 """ 4 """
5 from django.conf.urls import patterns, url 5 from django.conf.urls import url
6 from django.views.generic import DetailView, ListView 6 from django.views.generic import DetailView, ListView
7 7
8 from news.models import News 8 from news.models import News
9 9
10 10
11 urlpatterns = patterns('', 11 urlpatterns = [
12 url(r'^$', 12 url(r'^$',
13 ListView.as_view( 13 ListView.as_view(
14 model=News, 14 model=News,
15 paginate_by=10, 15 paginate_by=10,
16 context_object_name='news_list'), 16 context_object_name='news_list'),
17 name='news-index'), 17 name='news-index'),
18 url(r'^story/(?P<pk>\d+)/$', 18 url(r'^story/(?P<pk>\d+)/$',
19 DetailView.as_view(model=News, context_object_name='story'), 19 DetailView.as_view(model=News, context_object_name='story'),
20 name='news-item') 20 name='news-item')
21 ) 21 ]