comparison contests/urls.py @ 1085:16e190fa6ef8

Port contests app to V3 design.
author Brian Neal <bgneal@gmail.com>
date Mon, 02 May 2016 20:03:18 -0500
parents 5ba2508939f7
children
comparison
equal deleted inserted replaced
1084:5fa22ed8bfb2 1085:16e190fa6ef8
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 url 5 from django.conf.urls import url
6 from django.views.generic import DetailView, ListView
7 6
8 from contests.models import Contest
9 import contests.views 7 import contests.views
10 8
11 9
12 urlpatterns = [ 10 urlpatterns = [
13 url(r'^$', 11 url(r'^$',
14 ListView.as_view( 12 contests.views.ContestListView.as_view(),
15 context_object_name='contests',
16 queryset=Contest.public_objects.all().prefetch_related('winners')),
17 name='contests-index'), 13 name='contests-index'),
18 14
19 url(r'^enter/$', 15 url(r'^enter/$',
20 contests.views.enter, 16 contests.views.enter,
21 name='contests-enter'), 17 name='contests-enter'),
22 18
23 url(r'^c/(?P<slug>[\w-]+)/$', 19 url(r'^c/(?P<slug>[\w-]+)/$',
24 DetailView.as_view( 20 contests.views.ContestDetailView.as_view(),
25 context_object_name='contest',
26 queryset=Contest.public_objects.all().prefetch_related('winners')),
27 name='contests-contest'), 21 name='contests-contest'),
28 ] 22 ]