From 0216f02c1e5c03c20219cfe6e8c70d10d2ad5afd Mon Sep 17 00:00:00 2001 From: Derek Eder Date: Fri, 19 Jan 2024 16:54:24 -0600 Subject: [PATCH] fix rss for search, removed CITY_VOCAB references --- chicago/feeds.py | 30 +- chicago/templates/committee.html | 2 +- .../templates/compare_council_members.html | 10 +- chicago/templates/event.html | 2 +- chicago/templates/events.html | 2 +- chicago/templates/legislation.html | 2 +- .../partials/committee_person_table.html | 2 +- .../partials/component_upcoming_events.html | 2 +- .../partials/council_member_table.html | 8 +- chicago/templates/search/search.html | 545 +++++++++--------- 10 files changed, 294 insertions(+), 311 deletions(-) diff --git a/chicago/feeds.py b/chicago/feeds.py index 1308b8b..1ca69f2 100644 --- a/chicago/feeds.py +++ b/chicago/feeds.py @@ -16,11 +16,12 @@ class FacetedSearchFeed(Feed): description_template = "feeds/search_item_description.html" bill_model = Bill - all_results = None + results = None sqs = ( SearchQuerySet() .facet("bill_type") - .facet("sponsorships", sort="index") + .facet("topics") + .facet("sponsorships") .facet("controlling_body") .facet("inferred_status") ) @@ -30,9 +31,9 @@ def url_with_querystring(self, path, **kwargs): return path + "?" + urllib.parse.urlencode(kwargs) def get_object(self, request): - self.queryDict = request.GET + self.query = request.GET.urlencode() - all_results = SearchQuerySet().all() + results = self.sqs facets = None if "selected_facets" in request.GET: @@ -40,19 +41,13 @@ def get_object(self, request): if "q" in request.GET: self.query = request.GET["q"] - results = all_results.filter(content=self.query) - - if facets: - for facet in facets: - (facet_name, facet_value) = facet.split(":") - facet_name = facet_name.rsplit("_exact")[0] - results = results.narrow("%s:%s" % (facet_name, facet_value)) - elif facets: + results = results.filter(content=self.query) + + if facets: for facet in facets: - (facet_name, facet_value) = facet.split(":") - facet_name = facet_name.rsplit("_exact")[0] - results = all_results.narrow("%s:%s" % (facet_name, facet_value)) + results = results.narrow(facet) + self.results = results return results.order_by("-last_action_date") def title(self, obj): @@ -63,7 +58,6 @@ def title(self, obj): + self.query.capitalize() + "'" ) - # XXX: create a nice title based on all search parameters else: title = settings.SITE_META["site_name"] + ": Filtered Search" @@ -85,8 +79,8 @@ def item_pubdate(self, bill): def description(self, obj): return "Bills returned from search" - def items(self, query): - l_items = query[:20] + def items(self, results): + l_items = results[:20] pks = [i.pk for i in l_items] bills = self.bill_model.objects.filter(pk__in=pks).order_by("-last_action_date") return bills diff --git a/chicago/templates/committee.html b/chicago/templates/committee.html index c12d7cc..d6a121e 100644 --- a/chicago/templates/committee.html +++ b/chicago/templates/committee.html @@ -23,7 +23,7 @@

Committee Members ({{ committee.all_member {% if committee.recent_events %}