Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f12a5e

Browse filesBrowse files
JelteFmhagander
authored andcommitted
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.
1 parent 429ea84 commit 9f12a5e
Copy full SHA for 9f12a5e

File tree

2 files changed

+7
-0
lines changed
Filter options

2 files changed

+7
-0
lines changed

‎pgcommitfest/commitfest/views.py

Copy file name to clipboardExpand all lines: pgcommitfest/commitfest/views.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ def global_search(request):
258258
'title': 'Patch search results',
259259
})
260260

261+
def patch_redirect(request, patchid):
262+
last_commitfest = PatchOnCommitFest.objects.select_related('commitfest').filter(patch_id=patchid).order_by('-commitfest__startdate').first()
263+
if not last_commitfest:
264+
raise Http404("Patch not found")
265+
return HttpResponseRedirect(f'/{last_commitfest.commitfest_id}/{patchid}/')
266+
261267

262268
def patch(request, cfid, patchid):
263269
cf = get_object_or_404(CommitFest, pk=cfid)

‎pgcommitfest/urls.py

Copy file name to clipboardExpand all lines: pgcommitfest/urls.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
re_path(r'^(\d+)/$', views.commitfest),
2020
re_path(r'^(open|inprogress|current)/(.*)$', views.redir),
2121
re_path(r'^(?P<cfid>\d+)/activity(?P<rss>\.rss)?/$', views.activity),
22+
re_path(r'^patch/(\d+)/$', views.patch_redirect),
2223
re_path(r'^(\d+)/(\d+)/$', views.patch),
2324
re_path(r'^(\d+)/(\d+)/edit/$', views.patchform),
2425
re_path(r'^(\d+)/new/$', views.newpatch),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.