comparison contests/urls.py @ 1028:5ba2508939f7

Django 1.8 changes; first batch.
author Brian Neal <bgneal@gmail.com>
date Tue, 15 Dec 2015 21:01:07 -0600
parents 5977b43499f7
children 16e190fa6ef8
comparison
equal deleted inserted replaced
1027:cd4db27c90e3 1028:5ba2508939f7
1 """ 1 """
2 Url patterns for the contests application. 2 Url patterns for the contests 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 contests.models import Contest 8 from contests.models import Contest
9 import contests.views
9 10
10 11
11 urlpatterns = patterns('', 12 urlpatterns = [
12 url(r'^$', 13 url(r'^$',
13 ListView.as_view( 14 ListView.as_view(
14 context_object_name='contests', 15 context_object_name='contests',
15 queryset=Contest.public_objects.all().prefetch_related('winners')), 16 queryset=Contest.public_objects.all().prefetch_related('winners')),
16 name='contests-index'), 17 name='contests-index'),
17 18
18 url(r'^enter/$', 19 url(r'^enter/$',
19 'contests.views.enter', 20 contests.views.enter,
20 name='contests-enter'), 21 name='contests-enter'),
21 22
22 url(r'^c/(?P<slug>[\w-]+)/$', 23 url(r'^c/(?P<slug>[\w-]+)/$',
23 DetailView.as_view( 24 DetailView.as_view(
24 context_object_name='contest', 25 context_object_name='contest',
25 queryset=Contest.public_objects.all().prefetch_related('winners')), 26 queryset=Contest.public_objects.all().prefetch_related('winners')),
26 name='contests-contest'), 27 name='contests-contest'),
27 ) 28 ]