Skip to content

Commit

Permalink
address error caused by attempt to convert decimal string into integer
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Feb 5, 2024
1 parent 1bf8b47 commit ff67a56
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion coldfront/core/allocation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,14 @@ def post(self, request, *args, **kwargs):

new_value = formset_data.get('new_value')
# require nese shares to be divisible by 20
tbs = int(new_value) if formset_data['name'] == 'Storage Quota (TB)' else False
if formset_data['name'] == 'Storage Quota (TB)':
try:
tbs = int(new_value)
except ValueError:
messages.error(request, 'Requested storage quota must be an integer.')
return HttpResponseRedirect(reverse('allocation-change', kwargs={'pk': pk}))
else:
tbs = False
if nese and tbs and tbs % 20 != 0:
messages.error(request, "Tier 3 quantity must be a multiple of 20.")
return HttpResponseRedirect(reverse('allocation-change', kwargs={'pk': pk}))
Expand Down

0 comments on commit ff67a56

Please sign in to comment.