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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user