From 5b6cd7da13c4f00313b07f113abff404670a65b6 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sat, 8 Jul 2017 21:32:47 +0200 Subject: [PATCH] Support listname in the URL, not just the id This will make it easier to link to a search form that properly pre-populates the dropdown. This will be followed with a patch to the archives to generate links this way. It's not strictly speaking needed to support this as we currently synchronize the list id between the systems, but that's something that is likely going away in the future. --- pgweb/search/views.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pgweb/search/views.py b/pgweb/search/views.py index 6fa479ae..4564fe46 100644 --- a/pgweb/search/views.py +++ b/pgweb/search/views.py @@ -72,7 +72,17 @@ def search(request): else: listid = None else: - listid = None + # Listid not specified. But do we have the name? + if request.GET.has_key('ln'): + try: + ll = MailingList.objects.get(listname=request.GET['ln']) + listid = ll.id + except MailingList.DoesNotExist: + # Invalid list name just resets the default of the form, + # no need to throw an error. + listid = None + else: + listid = None if request.GET.has_key('d'): try: -- 2.39.5