Redirect /open fully
authorJelte Fennema-Nio <[email protected]>
Sat, 22 Jun 2024 10:54:17 +0000 (12:54 +0200)
committerMagnus Hagander <[email protected]>
Fri, 2 Aug 2024 11:32:56 +0000 (13:32 +0200)
Now it forwards everything after the slash so that links like the
following work:

/open/new/
/open?author=-3

pgcommitfest/commitfest/views.py
pgcommitfest/urls.py

index 6040c1b06426ae63a0c49823e27fe6b9e16c5f95..6a1f2943402fecce531458b573e39360947d2a13 100644 (file)
@@ -81,7 +81,7 @@ def activity(request, cfid=None, rss=None):
         })
 
 
-def redir(request, what):
+def redir(request, what, end):
     if what == 'open':
         cfs = list(CommitFest.objects.filter(status=CommitFest.STATUS_OPEN))
     elif what == 'inprogress':
@@ -96,7 +96,10 @@ def redir(request, what):
         messages.warning(request, "More than one {0} commitfest exists, redirecting to startpage instead.".format(what))
         return HttpResponseRedirect("/")
 
-    return HttpResponseRedirect("/%s/" % cfs[0].id)
+    query_string = request.GET.urlencode()
+    if query_string:
+        query_string = '?' + query_string
+    return HttpResponseRedirect(f"/{cfs[0].id}/{end}{query_string}")
 
 
 def commitfest(request, cfid):
index d15705ec7117e7bf643e25e03d14e4566b8451e1..9e4d6f8c9aa64d9c03982a822498c44684e9ad0e 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)/(.*)$', 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),