datamade / django-councilmatic

:heartpulse: Django app providing core functions for *.councilmatic.org
http://councilmatic.org
MIT License
26 stars 16 forks source link

Make no results iterable #72

Closed patcon closed 8 years ago

patcon commented 8 years ago

There are quite a few places in the models where, if no results exist, we return None. But there are quite a few places where a queryset is assumed to have results, and we chain it as if it's an iterable.

Can we start returning an empty list i n these places so that we don't need to keep accommodating special cases?

Example:

cathydeng commented 8 years ago

ya this sounds reasonable - wana open a PR?

patcon commented 8 years ago

Ok, I basically just skimmed through for any plural model property, and ensured that it returned an empty list that's still an iterable (rather than None), if it was plural. Singular properties still return None.