Skip to content

Commit

Permalink
displaying summary for latest bill version
Browse files Browse the repository at this point in the history
  • Loading branch information
derekeder committed Apr 5, 2024
1 parent 1f27802 commit 05cd78d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
15 changes: 13 additions & 2 deletions chicago/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,25 @@ def addresses(self):

return []

@property
def current_version(self):
# this needs to be improved to use some logic to pick out
# the most recent version instead of just first()
if self.versions.all():
return self.versions.first()
else:
return None

@cached_property
def full_text_doc_url(self):
"""
override this if instead of having full text as string stored in
full_text, it is a PDF document that you can embed on the page
"""
if self.versions.all():
most_recent = self.versions.first().links.first().url

current_version = self.current_version
if current_version:
most_recent = current_version.links.first().url
return most_recent
else:
return None
Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% include 'partials/icons.html' %}

<meta name="google-site-verification" content="6GhAJfsL-lriLRGXSHXYHcAYDMrr_UFU8t3mrgohknM" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
<script src="https://kit.fontawesome.com/a368ef962b.js" crossorigin="anonymous"></script>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,300italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.journal.min.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/dataTables.bootstrap.css' %}" />
Expand Down
5 changes: 5 additions & 0 deletions chicago/templates/legislation.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ <h1 class="bill-page-title">
<br/>
<p>{{ legislation.title }}</p>

{% if legislation.current_version.extras.summary %}
<h3><i class="fa-solid fa-robot"></i> Auto-generated summary</h3>
<p>{{legislation.current_version.extras.summary }}</p>
{% endif %}

{% with other_identifiers=alternate_identifiers %}
{% if other_identifiers %}
<p>
Expand Down

0 comments on commit 05cd78d

Please sign in to comment.