From: Jelte Fennema-Nio Date: Sat, 22 Jun 2024 10:54:17 +0000 (+0200) Subject: Redirect /open fully X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=485caaf65a10da53ce2c186c487150d2865de147;p=pgcommitfest2.git Redirect /open fully Now it forwards everything after the slash so that links like the following work: /open/new/ /open?author=-3 --- diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index 6040c1b..6a1f294 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -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): diff --git a/pgcommitfest/urls.py b/pgcommitfest/urls.py index d15705e..9e4d6f8 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)/(.*)$', 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),