Metro-Records / la-metro-councilmatic

:metro: An instance of councilmatic for LA Metro
MIT License
6 stars 2 forks source link

AttributeError: 'NoneType' object has no attribute 'post' #626

Closed sentry-io[bot] closed 4 years ago

sentry-io[bot] commented 4 years ago

Sentry Issue: LA-METRO-COUNCILMATIC-38

AttributeError: 'NoneType' object has no attribute 'post'
(3 additional frame(s) were not displayed)
...
  File "django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "lametro/views.py", line 538, in dispatch
    response = super().dispatch(request, *args, **kwargs)
  File "django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "django/views/generic/detail.py", line 107, in get
    context = self.get_context_data(object=self.object)
  File "lametro/views.py", line 559, in get_context_data
    council_post = person.latest_council_membership.post
hancush commented 4 years ago

FWIW, these exceptions are raised when visiting person pages for members of the taxpayer oversight committee. I believe this is the case because members of the oversight committee are not necessarily members of the board, but board membership is a condition of the query we use. We should adapt the query, given this new case.

To reproduce, click any of the members listed here: https://boardagendas.metro.net/committee/measure-m-independent-taxpayer-oversight-committee-7e96a2767a4f/

hancush commented 4 years ago

Actually, @shrayshray, do you expect to be able to view person pages for members of the Measure M Taxpayer Oversight Committee? If not, we can de-link the pages (i.e., show oversight committee members' names as plain text rather than hyperlinks). Otherwise, we can fix the person pages as described in https://github.com/datamade/la-metro-councilmatic/issues/626#issuecomment-657551247. Let me know what the expected behavior is!

shrayshray commented 4 years ago

@hancush Yes, please show the list of member names for Measure M Taxpayer Oversight Committee without hyperlinks as they are not members of the Metro Board.

hancush commented 4 years ago

@shrayshray I've deployed this to the staging site: https://lametro-upgrade.datamade.us/committee/measure-m-independent-taxpayer-oversight-committee-2bdef3c4809d/

Look ok to you?

shrayshray commented 4 years ago

@hancush this looks great!

hancush commented 4 years ago

Awesome, deployed!