Process states param to gather all passed-in states.

This commit is contained in:
John Eskew
2018-04-29 10:43:36 -04:00
parent 2be587d32d
commit e7bdbe6846

View File

@@ -396,11 +396,13 @@ class AccountRetirementView(ViewSet):
"""
try:
cool_off_days = int(request.GET['cool_off_days'])
states = request.GET['states'].split(',')
if cool_off_days < 0:
raise RetirementStateError('Invalid argument for cool_off_days, must be greater than 0.')
states = request.GET.getlist('states')
if not states:
raise RetirementStateError('Param "states" required with at least one state.')
state_objs = RetirementState.objects.filter(state_name__in=states)
if state_objs.count() != len(states):
found = [s.state_name for s in state_objs]