view contests/urls.py @ 581:ee87ea74d46b

For Django 1.4, rearranged project structure for new manage.py.
author Brian Neal <bgneal@gmail.com>
date Sat, 05 May 2012 17:10:48 -0500
parents gpp/contests/urls.py@ddd69a8e07c7
children 5977b43499f7
line wrap: on
line source
"""
Url patterns for the contests application.

"""
from django.conf.urls import patterns, url
from django.views.generic import DetailView, ListView

from contests.models import Contest


urlpatterns = patterns('',
   url(r'^$',
       ListView.as_view(
           context_object_name='contests',
           queryset=Contest.public_objects.select_related('winner')),
       name='contests-index'),

   url(r'^enter/$',
       'contests.views.enter',
       name='contests-enter'),

   url(r'^c/(?P<slug>[\w-]+)/$',
       DetailView.as_view(
           context_object_name='contest',
           queryset=Contest.public_objects.all().select_related('winner')),
       name='contests-contest'),
)