Skip to content

Commit

Permalink
Merge pull request #637 from datamade/hcg/handle-private-relations
Browse files Browse the repository at this point in the history
Handle private bills during event packet build
  • Loading branch information
hancush authored Aug 4, 2020
2 parents 763d585 + e8104c5 commit 22d6fbc
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lametro/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,21 @@ def related_files(self):

for item in agenda_items:
for entity in item.related_entities.filter(bill__isnull=False):
bill_packet = BillPacket(bill=entity.bill)
related.extend(bill_packet.related_files)
try:
related_bill = entity.bill
except LAMetroBill.DoesNotExist:
# We configure event agenda items to return LAMetroBill
# objects. Sometimes, agenda items concern bills that do
# not meet criteria for display, e.g., the bill is private
# or it does not appear on a published agenda. (See the
# LAMetroBill manager for an exhaustive list of display
# criteria.) In this case, trying to access the bill via
# the event agenda item will raise this exception. Skip
# adding those documents to the event packet.
continue
else:
bill_packet = BillPacket(bill=related_bill)
related.extend(bill_packet.related_files)

return related

Expand Down

0 comments on commit 22d6fbc

Please sign in to comment.