summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest/views.py
diff options
context:
space:
mode:
authorJelte Fennema-Nio2024-06-24 20:33:42 +0000
committerMagnus Hagander2024-08-02 11:46:01 +0000
commit9f12a5e83f135c106f200565a427c0e13ae474af (patch)
tree36e17bab12033915580449fba0093dcbf7fe51e1 /pgcommitfest/commitfest/views.py
parent429ea84fe875505fa840eda246a83960f76dda28 (diff)
Add a stable URL for a patch that redirects to latest cf
Links to patches get outdated ever time we move it to new commitfest.
Diffstat (limited to 'pgcommitfest/commitfest/views.py')
-rw-r--r--pgcommitfest/commitfest/views.py6
1 files changed, 6 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)