annotate gpp/contests/urls.py @ 552:9e42e6618168

For bitbucket issue #2, tweak the admin settings for the Post model to reduce slow queries. Define our own queryset() method so we can control the select_related(), and not have it cascade from post to topics to forums to categories. Removed 'topic' from list_display because MySQL still sucked with 2 inner joins. Now it seems to be tolerable with only one join to User.
author Brian Neal <bgneal@gmail.com>
date Wed, 25 Jan 2012 20:07:03 -0600
parents 51fa1e0ca218
children 0a8e6a9ccf53
rev   line source
bgneal@540 1 """
bgneal@540 2 Url patterns for the contests application.
bgneal@540 3
bgneal@540 4 """
bgneal@540 5 from django.conf.urls.defaults import patterns, url
bgneal@540 6 from django.views.generic import DetailView, ListView
bgneal@540 7
bgneal@540 8 from contests.models import Contest
bgneal@540 9
bgneal@540 10
bgneal@540 11 urlpatterns = patterns('',
bgneal@540 12 url(r'^$',
bgneal@540 13 ListView.as_view(
bgneal@540 14 context_object_name='contests',
bgneal@540 15 queryset=Contest.public_objects.all()),
bgneal@540 16 name='contests-index'),
bgneal@540 17
bgneal@540 18 url(r'^enter/$',
bgneal@540 19 'contests.views.enter',
bgneal@540 20 name='contests-enter'),
bgneal@540 21
bgneal@540 22 url(r'^c/(?P<slug>[\w-]+)/$',
bgneal@540 23 DetailView.as_view(
bgneal@540 24 context_object_name='contest',
bgneal@540 25 queryset=Contest.public_objects.all().select_related('winner')),
bgneal@540 26 name='contests-contest'),
bgneal@540 27 )