From: Jelte Fennema-Nio Date: Sat, 22 Jun 2024 11:17:23 +0000 (+0200) Subject: Add /current link that links to either /inprogress or /open X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=429ea84fe875505fa840eda246a83960f76dda28;p=pgcommitfest2.git Add /current link that links to either /inprogress or /open --- diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index 6a1f294..40ae3c5 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -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() diff --git a/pgcommitfest/urls.py b/pgcommitfest/urls.py index 9e4d6f8..4f6e9d2 100644 --- a/pgcommitfest/urls.py +++ b/pgcommitfest/urls.py @@ -17,7 +17,7 @@ urlpatterns = [ re_path(r'^$', views.home), re_path(r'^activity(?P\.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\d+)/activity(?P\.rss)?/$', views.activity), re_path(r'^(\d+)/(\d+)/$', views.patch), re_path(r'^(\d+)/(\d+)/edit/$', views.patchform),