Skip to content

Commit

Permalink
keeping get_person_headshot for legislation page
Browse files Browse the repository at this point in the history
  • Loading branch information
derekeder committed Jun 5, 2024
1 parent ed632ea commit 9baf2f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chicago/templates/legislation.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h3 class="no-pad-bottom"><i class='fa fa-fw fa-users'></i> Sponsors</h3>
<tr>
<td>
<div class="thumbnail-square">
<img src='{{s.person.councilmatic_person.manual_headshot}}' alt='{{s.person.name}}' title='{{s.person.name}}' class='img-responsive' />
<img src='{{s.person.councilmatic_person|get_person_headshot}}' alt='{{s.person.name}}' title='{{s.person.name}}' class='img-responsive' />
</div>
</td>
<td>
Expand All @@ -88,7 +88,7 @@ <h3 class="no-pad-bottom"><i class='fa fa-fw fa-users'></i> Sponsors</h3>
<tr>
<td>
<div class="thumbnail-square">
<img src='{{s.person.councilmatic_person.manual_headshot}}' alt='{{s.person.name}}' title='{{s.person.name}}' class='img-responsive' />
<img src='{{s.person.councilmatic_person|get_person_headshot}}' alt='{{s.person.name}}' title='{{s.person.name}}' class='img-responsive' />
</div>
</td>
<td>
Expand Down
11 changes: 11 additions & 0 deletions chicago/templatetags/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.conf import settings

from urllib.parse import urlsplit, parse_qs, urlencode
from chicago.utils import get_alder_extras

register = template.Library()

Expand Down Expand Up @@ -151,6 +152,16 @@ def remove_question(text):
return text.rstrip("?")


@register.filter
def get_person_headshot(person):
"""used for getting person images when we don't have access to the model"""
extra = get_alder_extras(person.slug)
if extra:
return f"/static/images/manual-headshots/{extra['image']}" # noqa

return "/static/images/headshot_placeholder.png"


@register.filter
def get_legistar_link(object):
try:
Expand Down

0 comments on commit 9baf2f9

Please sign in to comment.