• Vladimir Mencl's avatar
    AllServicePoints: fix MultipleObjectsReturned err · 3f929377
    Vladimir Mencl authored
    The get_all_services() breaks with unhandled exception MultipleObjectsReturned
    when there are multiple names (for either Institution or Service Location) with
    the selected language.
    And, this is permitted in the model, and we have users who create such DB state.
    Fix this by using filter(lang=...) instead of get(lang=...)
    And wrap the handling this for both org_name and loc_name in a single generic
    function - taking a
    django.contrib.contenttypes.fields.GenericRelatedObjectManager reference,
    language, default_language and default_value.
    This also removes the exception handling clutter from get_all_services().
views.py 82.3 KB