Skip to content

Commit

Permalink
Merge pull request #421 from datamade/campaign-donations
Browse files Browse the repository at this point in the history
add campaign contributions to person detail
  • Loading branch information
derekeder authored Jun 7, 2024
2 parents 1f27802 + 9baf2f9 commit 3b6a88b
Show file tree
Hide file tree
Showing 11 changed files with 249 additions and 231 deletions.
29 changes: 17 additions & 12 deletions chicago/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pytz
from councilmatic_core.models import Bill, Event, Organization, Person
from chicago.utils import get_alder_extras
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.db import models
Expand Down Expand Up @@ -225,24 +226,28 @@ def legislation_count(self):
sponsorships__person=self, sponsorships__primary=True
).count()

@property
def election_status(self):
for p in settings.ALDER_EXTRAS:
if (
self.slug.startswith(p)
and "election-status" in settings.ALDER_EXTRAS[p]
):
return settings.ALDER_EXTRAS[p]["election-status"]
def extra_props(self, key):
extra = get_alder_extras(self.slug)
if extra and key in extra:
return extra[key]

return ""

@property
def caucus(self):
for p in settings.ALDER_EXTRAS:
if self.slug.startswith(p) and "caucus" in settings.ALDER_EXTRAS[p]:
return settings.ALDER_EXTRAS[p]["caucus"]
return self.extra_props("caucus")

return ""
@property
def candidate_id(self):
return self.extra_props("candidate_id")

@property
def manual_headshot(self):
image_path = self.extra_props("image")
if image_path:
return f"/static/images/manual-headshots/{image_path}" # noqa

return "/static/images/headshot_placeholder.png"

@property
def term_active(self):
Expand Down
206 changes: 1 addition & 205 deletions chicago/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
sentry_sdk.init(
dsn=os.environ["SENTRY_DSN"],
integrations=[DjangoIntegration()],
release=f"{os.environ['HEROKU_RELEASE_VERSION']}-{os.environ['HEROKU_APP_NAME']}",
release=f"{os.environ['HEROKU_RELEASE_VERSION']}-{os.environ['HEROKU_APP_NAME']}", # noqa
enable_tracing=True,
traces_sample_rate=0.05,
)
Expand Down Expand Up @@ -326,210 +326,6 @@
"valencia-anna-m-257a68ccbc17": "City Clerk",
}

ALDER_EXTRAS = {
"abarca-anabel": {"image": "abarca-anabel.jpg"},
"arena-john": {"image": "arena-john.jpg"},
"austin-carrie-m": {
"image": "austin-carrie-m.jpg",
"election-status": "Indicted, Retiring",
"caucus": "Black Caucus",
},
"beale-anthony": {"image": "beale-anthony.jpg", "caucus": "Black Caucus"},
"brookins-jr-howard": {
"image": "brookins-jr-howard.jpg",
"caucus": "Black Caucus",
"election-status": "Retiring",
},
"burke-edward-m": {
"image": "burke-edward-m.jpg",
"election-status": "Indicted, Retiring",
},
"burnett-jr-walter": {"image": "burnett-jr-walter.jpg", "caucus": "Black Caucus"},
"burns-william-d": {"image": "burns-william-d.jpg"},
"cappleman-james": {
"image": "cappleman-james.jpg",
"election-status": "Retiring",
"caucus": "LGBT Caucus",
},
"cardenas-george-a": {"image": "cardenas-george-a.jpg", "caucus": "Latino Caucus"},
"cardona-jr-felix": {
"image": "cardona-jr-felix.jpg",
"caucus": "Latino Caucus",
},
"cochran-willie": {"image": "cochran-willie.jpg"},
"coleman-stephanie-d": {
"image": "coleman-stephanie-d.jpg",
"caucus": "Black Caucus",
},
"curtis-derrick-g": {"image": "curtis-derrick-g.jpg", "caucus": "Black Caucus"},
"dowell-pat": {"image": "dowell-pat.jpg", "caucus": "Black Caucus"},
"emanuel-rahm": {"image": "emanuel-rahm.jpg"},
"ervin-jason-c": {"image": "ervin-jason-c.jpg", "caucus": "Black Caucus"},
"foulkes-toni": {"image": "foulkes-toni.jpg"},
"gardiner-james-m": {"image": "gardiner-james-m.jpg"},
"hadden-maria-e": {
"image": "hadden-maria-e.jpg",
"caucus": "Black Caucus, Progressive Caucus, LGBT Caucus",
},
"hairston-leslie-a": {
"image": "hairston-leslie-a.jpg",
"election-status": "Retiring",
"caucus": "Black Caucus, Progressive Caucus",
},
"harris-michelle-a": {"image": "harris-michelle-a.jpg", "caucus": "Black Caucus"},
"hopkins-brian": {"image": "hopkins-brian.jpg"},
"king-sophia": {
"image": "king-sophia.jpg",
"election-status": "Running for Mayor, not seeking re-election",
"caucus": "Black Caucus, Progressive Caucus",
},
"knudsen-timothy-r": {"image": "knudsen-timothy-r.jpg", "caucus": "LGBT Caucus"},
"la-spata-daniel": {
"image": "la-spata-daniel.jpg",
"caucus": "Democratic Socialist, Latino Caucus, Progressive Caucus",
},
"laurino-margaret": {"image": "laurino-margaret.jpg"},
"lee-nicole-t": {"image": "lee-nicole-t.jpg"},
"lopez-raymond-a": {"image": "lopez-raymond-a.jpg", "caucus": "LGBT Caucus"},
"lightfoot-lori-e": {"image": "lightfoot-lori-e.jpg"},
"maldonado-roberto": {
"image": "maldonado-roberto.jpg",
"election-status": "Retiring",
"caucus": "Latino Caucus",
},
"martin-matthew-j": {
"image": "martin-matthew-j.jpg",
"caucus": "Black Caucus, Progressive Caucus",
},
"mell-deborah": {"image": "mell-deborah.jpg"},
"mendoza-susana-a": {"image": "mendoza-susana-a.jpg"},
"mitchell-gregory-i": {"image": "mitchell-gregory-i.jpg", "caucus": "Black Caucus"},
"mitts-emma": {"image": "mitts-emma.jpg", "caucus": "Black Caucus"},
"moore-david-h": {
"image": "moore-david-h.jpg",
"caucus": "Black Caucus",
},
"moore-joseph": {"image": "moore-joseph.jpg"},
"moreno-proco-joe": {"image": "moreno-proco-joe.jpg"},
"munoz-ricardo": {"image": "munoz-ricardo.jpg"},
"napolitano-anthony-v": {"image": "napolitano-anthony-v.jpg"},
"nugent-samantha": {"image": "nugent-samantha.jpg"},
"oconnor-patrick": {"image": "oconnor-patrick.jpg"},
"oshea-matthew-j": {"image": "oshea-matthew-j.jpg"},
"osterman-harry": {"image": "osterman-harry.jpg", "election-status": "Retiring"},
"pawar-ameya": {"image": "pawar-ameya.jpg"},
"quinn-marty": {"image": "quinn-marty.jpg"},
"ramirez-rosa-carlos": {
"image": "ramirez-rosa-carlos.jpg",
"caucus": "Democratic Socialist, Latino Caucus, Progressive Caucus, LGBT Caucus", # noqa
},
"reboyras-ariel": {
"image": "reboyras-ariel.jpg",
"caucus": "Latino Caucus",
"election-status": "Retiring",
},
"reilly-brendan": {"image": "reilly-brendan.jpg"},
"rodriguez-michael-d": {
"image": "rodriguez-michael-d.jpg",
"caucus": "Latino Caucus, Progressive Caucus",
},
"rodriguez-sanchez-rossana": {
"image": "rodriguez-sanchez-rossana.jpg",
"caucus": "Democratic Socialist, Latino Caucus, Progressive Caucus",
},
"sadlowski-garza-susan": {
"image": "sadlowski-garza-susan.jpg",
"election-status": "Retiring",
"caucus": "Latino Caucus, Progressive Caucus",
},
"santiago-milagros-s": {"image": "santiago-milagros-s.jpg"},
"sawyer-roderick-t": {
"image": "sawyer-roderick-t.jpg",
"election-status": "Running for Mayor, not seeking re-election",
"caucus": "Black Caucus, Progressive Caucus",
},
"scott-jr-michael": {"image": "scott-jr-michael.jpg", "caucus": "Black Caucus"},
"scott-monique-l": {"image": "scott-monique-l.jpg", "caucus": "Black Caucus"},
"sigcho-lopez-byron": {
"image": "sigcho-lopez-byron.jpg",
"caucus": "Democratic Socialist, Latino Caucus, Progressive Caucus",
},
"silverstein-debra-l": {"image": "silverstein-debra-l.jpg"},
"smith-michele": {"image": "smith-michele.jpg", "election-status": "Retiring"},
"solis-daniel": {"image": "solis-daniel.jpg"},
"sposato-nicholas": {"image": "sposato-nicholas.png"},
"tabares-silvana": {"image": "tabares-silvana.jpg", "caucus": "Latino Caucus"},
"taliaferro-chris": {
"image": "taliaferro-chris.jpg",
"caucus": "Black Caucus",
},
"taylor-jeanette-b": {
"image": "taylor-jeanette-b.jpg",
"caucus": "Black Caucus, Democratic Socialist, Progressive Caucus",
},
"thompson-patrick-d": {"image": "thompson-patrick-d.jpg"},
"tunney-thomas": {
"image": "tunney-thomas.jpg",
"election-status": "Retiring",
"caucus": "LGBT Caucus",
},
"valencia-anna-m": {"image": "valencia-anna-m.jpg"},
"vasquez-jr-andre": {
"image": "vasquez-jr-andre.jpg",
"caucus": "Latino Caucus, Progressive Caucus",
},
"villegas-gilbert": {"image": "villegas-gilbert.jpg", "caucus": "Latino Caucus"},
"waguespack-scott": {
"image": "waguespack-scott.jpg",
"caucus": "",
},
"zalewski-michael-r": {"image": "zalewski-michael-r.jpg"},
"yancy-desmon-c": {
"image": "yancy-desmon-c.jpg",
"caucus": "Black Caucus, Progressive Caucus",
},
"robinson-lamont": {
"image": "robinson-lamont.jpg",
"caucus": "Black Caucus",
},
"ramirez-julia-m": {
"image": "ramirez-julia-m.jpg",
"caucus": "Latino Caucus, Progressive Caucus",
},
"mosley-ronnie-l": {
"image": "mosley-ronnie-l.jpg",
"caucus": "Black Caucus",
},
"manaa-hoppenworth-leni": {"image": "manaa-hoppenworth-leni.jpg"},
"lawson-bennett-r": {"image": "lawson-bennett-r.jpg"},
"hall-william-e": {
"image": "hall-william-e.jpg",
"caucus": "Black Caucus",
},
"gutierrez-jeylu-b": {
"image": "gutierrez-jeylu-b.jpg",
"caucus": "Latino Caucus, Progressive Caucus",
},
"fuentes-jessica": {
"image": "fuentes-jessica.jpg",
"caucus": "Latino Caucus, Progressive Caucus",
},
"cruz-ruth": {
"image": "cruz-ruth.jpg",
"caucus": "Latino Caucus, Progressive Caucus",
},
"conway-william": {"image": "conway-william.jpg"},
"clay-angela": {
"image": "clay-angela.jpg",
"caucus": "Progressive Caucus",
},
"chico-peter": {
"image": "chico-peter.jpg",
"caucus": "Latino Caucus",
},
"johnson-brandon": {"image": "johnson-brandon.jpg"},
}

TOPIC_HIERARCHY = [
{
"name": "Citywide matters",
Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/compare_council_members.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h1>Compare Alders</h1>
<tr id="polygon-{{post.label | slugify}}">
<td>
<div class="thumbnail-square">
<img src='{{person|get_person_headshot}}' alt='{{person.name}}' title='{{person.name}}' class='img-responsive' />
<img src='{{person.manual_headshot}}' alt='{{person.name}}' title='{{person.name}}' class='img-responsive' />
</div>
</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/event.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ <h4>Alder Attendance: {{attendance_present}} Present, {{attendance_absent}} Abse
<tr class="{% if not p.attended %}danger{% endif %}">
<td>
<div class="thumbnail-square">
<img src='{{p.attendee|get_person_headshot}}' alt='{{p.attendee.name}}' title='{{p.attendee.name}}' class='img-responsive' />
<img src='{{p.attendee.manual_headshot}}' alt='{{p.attendee.name}}' title='{{p.attendee.name}}' class='img-responsive' />
</div>
</td>
<td><a href="{% url 'person' p.attendee.slug %}">{{p.attendee.name}}</a></td>
Expand Down
6 changes: 3 additions & 3 deletions chicago/templates/partials/committee_person_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<tr>
<td>
<div class="thumbnail-square">
<img src='{{ membership.person|get_person_headshot }}' alt='{{membership.person.name}}' title='{{membership.person.name}}' class='img-responsive' />
<img src='{{ membership.person.manual_headshot }}' alt='{{membership.person.name}}' title='{{membership.person.name}}' class='img-responsive' />
</div>
</td>
<td>
Expand All @@ -34,7 +34,7 @@
<tr>
<td>
<div class="thumbnail-square">
<img src='{{ membership.person|get_person_headshot }}' alt='{{membership.person.name}}' title='{{membership.person.name}}' class='img-responsive' />
<img src='{{ membership.person.manual_headshot }}' alt='{{membership.person.name}}' title='{{membership.person.name}}' class='img-responsive' />
</div>
</td>
<td>
Expand All @@ -52,7 +52,7 @@
<tr>
<td>
<div class="thumbnail-square">
<img src='{{ membership.person|get_person_headshot }}' alt='{{membership.person.name}}' title='{{membership.person.name}}' class='img-responsive' />
<img src='{{ membership.person.manual_headshot }}' alt='{{membership.person.name}}' title='{{membership.person.name}}' class='img-responsive' />
</div>
</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion chicago/templates/partials/council_member_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<td>
{% if post.current_member %}
<div class="thumbnail-square">
<img src='{{post.current_member.person|get_person_headshot}}' alt='{{post.current_member.person.name}}' title='{{post.current_member.person.name}}' class='img-responsive' />
<img src='{{post.current_member.person.manual_headshot}}' alt='{{post.current_member.person.name}}' title='{{post.current_member.person.name}}' class='img-responsive' />
</div>
{% endif %}
</td>
Expand Down
Loading

0 comments on commit 3b6a88b

Please sign in to comment.