Add extra validation step

This commit is contained in:
Oliver Walters 2019-05-11 00:07:21 +10:00
parent 8d5c4c521c
commit 6561a613d7

View File

@ -154,7 +154,10 @@ class StockMove(APIView):
if 'location' not in data:
raise ValidationError({'location': 'Destination must be specified'})
loc_id = data.get(u'location')
try:
loc_id = int(data.get('location'))
except ValueError:
raise ValidationError({'location': 'Integer ID required'})
try:
location = StockLocation.objects.get(pk=loc_id)