2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 20:45:44 +00:00

Remove references to get_object_or_404

- Properly handle DoesNotExist errors
This commit is contained in:
Oliver Walters
2019-04-28 11:09:19 +10:00
parent 624c5094c5
commit a9fbbc3a37
6 changed files with 78 additions and 42 deletions

View File

@ -101,7 +101,10 @@ class BuildCreate(AjaxCreateView):
part_id = self.request.GET.get('part', None)
if part_id:
initials['part'] = get_object_or_404(Part, pk=part_id)
try:
initials['part'] = Part.objects.get(pk=part_id)
except Part.DoesNotExist:
pass
return initials