summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pgcommitfest/commitfest/views.py6
-rw-r--r--pgcommitfest/urls.py1
2 files changed, 7 insertions, 0 deletions
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py
index 40ae3c5..0dcdb88 100644
--- a/pgcommitfest/commitfest/views.py
+++ b/pgcommitfest/commitfest/views.py
@@ -258,6 +258,12 @@ def global_search(request):
'title': 'Patch search results',
})
+def patch_redirect(request, patchid):
+ last_commitfest = PatchOnCommitFest.objects.select_related('commitfest').filter(patch_id=patchid).order_by('-commitfest__startdate').first()
+ if not last_commitfest:
+ raise Http404("Patch not found")
+ return HttpResponseRedirect(f'/{last_commitfest.commitfest_id}/{patchid}/')
+
def patch(request, cfid, patchid):
cf = get_object_or_404(CommitFest, pk=cfid)
diff --git a/pgcommitfest/urls.py b/pgcommitfest/urls.py
index 4f6e9d2..53fce1c 100644
--- a/pgcommitfest/urls.py
+++ b/pgcommitfest/urls.py
@@ -19,6 +19,7 @@ urlpatterns = [
re_path(r'^(\d+)/$', views.commitfest),
re_path(r'^(open|inprogress|current)/(.*)$', views.redir),
re_path(r'^(?P<cfid>\d+)/activity(?P<rss>\.rss)?/$', views.activity),
+ re_path(r'^patch/(\d+)/$', views.patch_redirect),
re_path(r'^(\d+)/(\d+)/$', views.patch),
re_path(r'^(\d+)/(\d+)/edit/$', views.patchform),
re_path(r'^(\d+)/new/$', views.newpatch),