From: Magnus Hagander Date: Mon, 19 Jan 2015 21:11:31 +0000 (+0100) Subject: Add commitfest redirects for /open and /inprogress X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=9b32be184483a7b29256ddb06e03679362c5e557;p=pgcommitfest2.git Add commitfest redirects for /open and /inprogress Requested by Robert Haas --- diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index fe5b560..b04030b 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -32,6 +32,16 @@ def home(request): 'title': 'Commitfests', }, context_instance=RequestContext(request)) +def redir(request, what): + if what == 'open': + cf = get_object_or_404(CommitFest, status=CommitFest.STATUS_OPEN) + elif what == 'inprogress': + cf = get_object_or_404(CommitFest, status=CommitFest.STATUS_INPROGRESS) + else: + raise Http404() + + return HttpResponseRedirect("/%s/" % cf.id) + def commitfest(request, cfid): # Find ourselves cf = get_object_or_404(CommitFest, pk=cfid) diff --git a/pgcommitfest/urls.py b/pgcommitfest/urls.py index fb32e67..ef1d38c 100644 --- a/pgcommitfest/urls.py +++ b/pgcommitfest/urls.py @@ -8,6 +8,7 @@ admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'commitfest.views.home'), url(r'^(\d+)/$', 'commitfest.views.commitfest'), + url(r'^(open|inprogress)/$', 'commitfest.views.redir'), url(r'^(\d+)/(\d+)/$', 'commitfest.views.patch'), url(r'^(\d+)/(\d+)/edit/$', 'commitfest.views.patchform'), url(r'^(\d+)/new/$', 'commitfest.views.newpatch'),