annotate contests/urls.py @ 1037:7e0c3cbd3cda
Fix bad select_related call.
In Django 1.8, select_related now throws an error if you give it an invalid
field. This was happening. Fix that query.
Also noticed an extra query generated in the display_post template. Fixed.
author |
Brian Neal <bgneal@gmail.com> |
date |
Tue, 29 Dec 2015 22:21:42 -0600 |
parents |
5ba2508939f7 |
children |
16e190fa6ef8 |
rev |
line source |
bgneal@540
|
1 """
|
bgneal@540
|
2 Url patterns for the contests application.
|
bgneal@540
|
3
|
bgneal@540
|
4 """
|
bgneal@1028
|
5 from django.conf.urls import url
|
bgneal@540
|
6 from django.views.generic import DetailView, ListView
|
bgneal@540
|
7
|
bgneal@540
|
8 from contests.models import Contest
|
bgneal@1028
|
9 import contests.views
|
bgneal@540
|
10
|
bgneal@540
|
11
|
bgneal@1028
|
12 urlpatterns = [
|
bgneal@540
|
13 url(r'^$',
|
bgneal@540
|
14 ListView.as_view(
|
bgneal@540
|
15 context_object_name='contests',
|
bgneal@796
|
16 queryset=Contest.public_objects.all().prefetch_related('winners')),
|
bgneal@540
|
17 name='contests-index'),
|
bgneal@540
|
18
|
bgneal@540
|
19 url(r'^enter/$',
|
bgneal@1028
|
20 contests.views.enter,
|
bgneal@540
|
21 name='contests-enter'),
|
bgneal@540
|
22
|
bgneal@540
|
23 url(r'^c/(?P<slug>[\w-]+)/$',
|
bgneal@540
|
24 DetailView.as_view(
|
bgneal@540
|
25 context_object_name='contest',
|
bgneal@796
|
26 queryset=Contest.public_objects.all().prefetch_related('winners')),
|
bgneal@540
|
27 name='contests-contest'),
|
bgneal@1028
|
28 ]
|