mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Error catching
This commit is contained in:
parent
34c34487b5
commit
3fb57abe66
@ -167,11 +167,14 @@ class BuildItemList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
def get_serializer(self, *args, **kwargs):
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
|
||||||
|
try:
|
||||||
params = self.request.query_params
|
params = self.request.query_params
|
||||||
|
|
||||||
kwargs['part_detail'] = str2bool(params.get('part_detail', False))
|
kwargs['part_detail'] = str2bool(params.get('part_detail', False))
|
||||||
kwargs['build_detail'] = str2bool(params.get('build_detail', False))
|
kwargs['build_detail'] = str2bool(params.get('build_detail', False))
|
||||||
kwargs['location_detail'] = str2bool(params.get('location_detail', False))
|
kwargs['location_detail'] = str2bool(params.get('location_detail', False))
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
return self.serializer_class(*args, **kwargs)
|
return self.serializer_class(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -103,17 +103,11 @@ class ManufacturerPartList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
# Do we wish to include extra detail?
|
# Do we wish to include extra detail?
|
||||||
try:
|
try:
|
||||||
kwargs['part_detail'] = str2bool(self.request.query_params.get('part_detail', None))
|
params = self.request.query_params
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
kwargs['part_detail'] = str2bool(params.get('part_detail', None))
|
||||||
kwargs['manufacturer_detail'] = str2bool(self.request.query_params.get('manufacturer_detail', None))
|
kwargs['manufacturer_detail'] = str2bool(params.get('manufacturer_detail', None))
|
||||||
except AttributeError:
|
kwargs['pretty'] = str2bool(params.get('pretty', None))
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
kwargs['pretty'] = str2bool(self.request.query_params.get('pretty', None))
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -252,22 +246,11 @@ class SupplierPartList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
# Do we wish to include extra detail?
|
# Do we wish to include extra detail?
|
||||||
try:
|
try:
|
||||||
kwargs['part_detail'] = str2bool(self.request.query_params.get('part_detail', None))
|
params = self.request.query_params
|
||||||
except AttributeError:
|
kwargs['part_detail'] = str2bool(params.get('part_detail', None))
|
||||||
pass
|
kwargs['supplier_detail'] = str2bool(params.get('supplier_detail', None))
|
||||||
|
kwargs['manufacturer_detail'] = str2bool(self.params.get('manufacturer_detail', None))
|
||||||
try:
|
kwargs['pretty'] = str2bool(params.get('pretty', None))
|
||||||
kwargs['supplier_detail'] = str2bool(self.request.query_params.get('supplier_detail', None))
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
kwargs['manufacturer_detail'] = str2bool(self.request.query_params.get('manufacturer_detail', None))
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
kwargs['pretty'] = str2bool(self.request.query_params.get('pretty', None))
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -423,17 +423,11 @@ class SOLineItemList(generics.ListCreateAPIView):
|
|||||||
def get_serializer(self, *args, **kwargs):
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
kwargs['part_detail'] = str2bool(self.request.query_params.get('part_detail', False))
|
params = self.request.query_params
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
kwargs['part_detail'] = str2bool(params.get('part_detail', False))
|
||||||
kwargs['order_detail'] = str2bool(self.request.query_params.get('order_detail', False))
|
kwargs['order_detail'] = str2bool(params.get('order_detail', False))
|
||||||
except AttributeError:
|
kwargs['allocations'] = str2bool(params.get('allocations', False))
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
kwargs['allocations'] = str2bool(self.request.query_params.get('allocations', False))
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -497,12 +491,15 @@ class SOAllocationList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
def get_serializer(self, *args, **kwargs):
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
|
||||||
|
try:
|
||||||
params = self.request.query_params
|
params = self.request.query_params
|
||||||
|
|
||||||
kwargs['part_detail'] = str2bool(params.get('part_detail', False))
|
kwargs['part_detail'] = str2bool(params.get('part_detail', False))
|
||||||
kwargs['item_detail'] = str2bool(params.get('item_detail', False))
|
kwargs['item_detail'] = str2bool(params.get('item_detail', False))
|
||||||
kwargs['order_detail'] = str2bool(params.get('order_detail', False))
|
kwargs['order_detail'] = str2bool(params.get('order_detail', False))
|
||||||
kwargs['location_detail'] = str2bool(params.get('location_detail', False))
|
kwargs['location_detail'] = str2bool(params.get('location_detail', False))
|
||||||
|
except ArithmeticError:
|
||||||
|
pass
|
||||||
|
|
||||||
return self.serializer_class(*args, **kwargs)
|
return self.serializer_class(*args, **kwargs)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user