From 9b32be184483a7b29256ddb06e03679362c5e557 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 19 Jan 2015 22:11:31 +0100 Subject: [PATCH] Add commitfest redirects for /open and /inprogress Requested by Robert Haas --- pgcommitfest/commitfest/views.py | 10 ++++++++++ pgcommitfest/urls.py | 1 + 2 files changed, 11 insertions(+) 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'), -- 2.39.5