From ae489b1045a46e32d4f3eb4be9a92730ca18ca8f Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Tue, 9 Aug 2022 07:20:30 +0100 Subject: [PATCH] Make tag handling much more flexible --- core/templates/ui/drilldown/drilldown.html | 151 ++++++++++----------- core/templates/ui/drilldown/results.html | 28 +++- core/views/ui/drilldown.py | 3 +- 3 files changed, 95 insertions(+), 87 deletions(-) diff --git a/core/templates/ui/drilldown/drilldown.html b/core/templates/ui/drilldown/drilldown.html index aa007ef..09c3de1 100644 --- a/core/templates/ui/drilldown/drilldown.html +++ b/core/templates/ui/drilldown/drilldown.html @@ -1,67 +1,89 @@ {% extends "base.html" %} {% load static %} +{% load joinsep %} {% block content %} @@ -339,38 +361,9 @@
- +
diff --git a/core/templates/ui/drilldown/results.html b/core/templates/ui/drilldown/results.html index a83f858..69d8e61 100644 --- a/core/templates/ui/drilldown/results.html +++ b/core/templates/ui/drilldown/results.html @@ -1,5 +1,6 @@ {% load static %} {% load index %} +{% load joinsep %} {% include 'partials/notify.html' %} {% if results %} - + {{ item.nick }} {% if item.num_chans is not None %} @@ -171,7 +172,7 @@
-{% endif %} \ No newline at end of file +{% endif %} +{# Update the tags in case the user changed the query #} +{# Check for focus and refocus #} + diff --git a/core/views/ui/drilldown.py b/core/views/ui/drilldown.py index 93c00cf..25906d7 100644 --- a/core/views/ui/drilldown.py +++ b/core/views/ui/drilldown.py @@ -72,7 +72,8 @@ def create_tags(query): spl = query.split("AND") spl = [x.strip() for x in spl if ":" in x] spl = [x.replace('"', "") for x in spl] - return spl + tags = [f"{tag}: {elem}" for tag, elem in [x.split(":") for x in spl]] + return tags def drilldown_search(request):