Add /current link that links to either /inprogress or /open
authorJelte Fennema-Nio <[email protected]>
Sat, 22 Jun 2024 11:17:23 +0000 (13:17 +0200)
committerMagnus Hagander <[email protected]>
Fri, 2 Aug 2024 11:33:31 +0000 (13:33 +0200)
pgcommitfest/commitfest/views.py
pgcommitfest/urls.py

index 6a1f2943402fecce531458b573e39360947d2a13..40ae3c544aba34f6f45991b412014e2d52729f67 100644 (file)
@@ -86,6 +86,10 @@ def redir(request, what, end):
         cfs = list(CommitFest.objects.filter(status=CommitFest.STATUS_OPEN))
     elif what == 'inprogress':
         cfs = list(CommitFest.objects.filter(status=CommitFest.STATUS_INPROGRESS))
+    elif what == 'current':
+        cfs = list(CommitFest.objects.filter(status=CommitFest.STATUS_INPROGRESS))
+        if len(cfs) == 0:
+            cfs = list(CommitFest.objects.filter(status=CommitFest.STATUS_OPEN))
     else:
         raise Http404()
 
index 9e4d6f8c9aa64d9c03982a822498c44684e9ad0e..4f6e9d2bc754a3228b7f772a746ba218e4e97448 100644 (file)
@@ -17,7 +17,7 @@ urlpatterns = [
     re_path(r'^$', views.home),
     re_path(r'^activity(?P<rss>\.rss)?/', views.activity),
     re_path(r'^(\d+)/$', views.commitfest),
-    re_path(r'^(open|inprogress)/(.*)$', views.redir),
+    re_path(r'^(open|inprogress|current)/(.*)$', views.redir),
     re_path(r'^(?P<cfid>\d+)/activity(?P<rss>\.rss)?/$', views.activity),
     re_path(r'^(\d+)/(\d+)/$', views.patch),
     re_path(r'^(\d+)/(\d+)/edit/$', views.patchform),