Mercurial > public > sg101
diff gpp/contests/urls.py @ 540:51fa1e0ca218
For #243, create a contests application.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 09 Jan 2012 01:13:08 +0000 |
parents | |
children | 0a8e6a9ccf53 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/contests/urls.py Mon Jan 09 01:13:08 2012 +0000 @@ -0,0 +1,27 @@ +""" +Url patterns for the contests application. + +""" +from django.conf.urls.defaults 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.all()), + 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'), +)