Skip to content

Commit

Permalink
Fix HQ admin filter being treated as an AND rather than as an OR when…
Browse files Browse the repository at this point in the history
… multiple selected.
  • Loading branch information
Sanjuro Jogdeo committed Apr 1, 2019
1 parent 2026913 commit 912b555
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions htdocs/dataviz/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
from .models import *

class GrantDonorFilterForm(forms.Form):
'''
IMPORTANT: If you add a field to the filters, you probably also want to include the field in the
prepare_related_donor_fields_to_lookup_fields function.
'''
region = forms.ModelChoiceField(
queryset = Region.objects.all(),
required = False,
Expand Down
3 changes: 3 additions & 0 deletions htdocs/pdviz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def prepare_related_donor_fields_to_lookup_fields(params, prefix):
"""

kwargs = {}
# print 'params', params
for k in params:
if k == 'format':
pass
Expand Down Expand Up @@ -45,6 +46,8 @@ def prepare_related_donor_fields_to_lookup_fields(params, prefix):
kwargs[prefix + 'amount_usd__lte'] = params[k]
elif k == 'status':
kwargs[prefix + 'status__in'] = params[k].split(',')
elif k == 'hq_admin':
kwargs[prefix + 'hq_admin__in'] = params[k].split(',')
else:
kwargs[prefix + k] = params[k]

Expand Down

0 comments on commit 912b555

Please sign in to comment.