• 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().
    3f929377
Name
Last commit
Last update
accounts Loading commit data...
djangobackends Loading commit data...
djnro Loading commit data...
docs Loading commit data...
edumanage Loading commit data...
extras Loading commit data...
front Loading commit data...
initial_data Loading commit data...
locale Loading commit data...
static Loading commit data...
utils Loading commit data...
.gitignore Loading commit data...
COPYING Loading commit data...
Changelog Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
__init__.py Loading commit data...
_version.py Loading commit data...
manage.py Loading commit data...
mkdocs.yml Loading commit data...
requirements-optional.txt Loading commit data...
requirements.txt Loading commit data...
upgrade-from-0.8-notes.txt Loading commit data...