Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix rss for search, removed CITY_VOCAB references #404

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions chicago/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
Expand All @@ -30,29 +31,23 @@ 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:
facets = request.GET.getlist("selected_facets")

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):
Expand All @@ -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"

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/committee.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h4><i class='fa fa-fw fa-group'></i> Committee Members ({{ committee.all_member

{% if committee.recent_events %}
<h4 class="modal-links">
<i class='fa fa-fw fa-calendar-o'></i> Committee {{ CITY_VOCAB.EVENTS }}&nbsp;
<i class='fa fa-fw fa-calendar-o'></i> Committee meetings&nbsp;

<small class="pull-right"><a href="events/rss/" title="RSS feed for Committee Events by {{committee.name}}"><i class="fa fa-rss-square" aria-hidden="true"></i> RSS feed for committee events</a></small>

Expand Down
10 changes: 5 additions & 5 deletions chicago/templates/compare_council_members.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% extends "base_with_margins.html" %}
{% load static extras %}
{% block title %}Compare {{CITY_VOCAB.COUNCIL_MEMBERS}}{% endblock %}
{% block title %}Compare Alders{% endblock %}

{% block content %}

<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<h1>Compare {{ CITY_VOCAB.COUNCIL_MEMBERS }}</h1>
<h1>Compare Alders</h1>

<p>On February 28, 2023, Chicago will hold a municipal election for Mayor, City Clerk, Treasurer and all 50 City Council Seats. See who is retiring and who is running for re-election and compare their attendance and legislative accomplishments.</p>
<p>Compare Alders on their tenure, attendance and legislative accomplishments.</p>

<p>Not sure who your Alder is? <a href="{% url 'council_members' %}">Look them up by your address ></a></p>
</div>
Expand All @@ -19,8 +19,8 @@ <h1>Compare {{ CITY_VOCAB.COUNCIL_MEMBERS }}</h1>
<thead>
<tr>
<th></th>
<th>{{ CITY_VOCAB.COUNCIL_MEMBER }}</th>
<th>{{CITY_VOCAB.MUNICIPAL_DISTRICT}}</th>
<th>Alder</th>
<th>Ward</th>
<th>Years in office</th>
<th>Non-routine bills sponsored</th>
<th>Attendance (this session)</th>
Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/event.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% block content %}

<br/>
<p><a href='/events/'><i class="fa fa-angle-double-left" aria-hidden="true"></i> {{ CITY_VOCAB.EVENTS }}</a></p>
<p><a href='/events/'><i class="fa fa-angle-double-left" aria-hidden="true"></i> Meetings</a></p>
<h1>{%if event.status == 'cancelled'%}CANCELLED: {% endif %}{{event.name}}</h1>
<p>{{event.description}}</p>

Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h2>
<div class="col-sm-4">
<br/>
<div class='well info-blurb'>
<h4><i class='fa fa-fw fa-info-circle'></i> What are these {{ CITY_VOCAB.EVENTS | lower}}?</h4>
<h4><i class='fa fa-fw fa-info-circle'></i> What are these meetings?</h4>

<p>There are two types of meetings: committee meetings and full city council meetings.</p>

Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/legislation.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h3 class="no-pad-bottom"><i class='fa fa-fw fa-users'></i> Sponsors</h3>
{% endif %}
</th>
<th>
{{CITY_VOCAB.MUNICIPAL_DISTRICT}}
Ward
</th>
</tr>
</thead>
Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/partials/committee_person_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<th></th>
<th>Committee Member</th>
<th>
{{CITY_VOCAB.MUNICIPAL_DISTRICT}}
Ward
</th>
<th>Role</th>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/partials/component_upcoming_events.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3>
{% endfor %}
<br/>
<a href="/events/" class="btn btn-sm btn-primary">
View All Upcoming {{ CITY_VOCAB.EVENTS }}
View All Upcoming Meetings
<i class="fa fa-fw fa-chevron-right"></i>
</a>
{% endif %}
8 changes: 2 additions & 6 deletions chicago/templates/partials/council_member_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
<thead>
<tr>
<th></th>
<th>
{{ CITY_VOCAB.COUNCIL_MEMBER }}
</th>
<th>
{{CITY_VOCAB.MUNICIPAL_DISTRICT}}
</th>
<th>Alder</th>
<th>Ward</th>
</tr>
</thead>
<tbody>
Expand Down
Loading