mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	Merge pull request #420 from SchrodingersGat/apidoc-fix
Catch case in which a request.GET is not available
This commit is contained in:
		@@ -89,7 +89,10 @@ class SupplierPartList(generics.ListCreateAPIView):
 | 
				
			|||||||
    def get_serializer(self, *args, **kwargs):
 | 
					    def get_serializer(self, *args, **kwargs):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Do we wish to include extra detail?
 | 
					        # Do we wish to include extra detail?
 | 
				
			||||||
 | 
					        try:
 | 
				
			||||||
            part_detail = str2bool(self.request.GET.get('part_detail', None))
 | 
					            part_detail = str2bool(self.request.GET.get('part_detail', None))
 | 
				
			||||||
 | 
					        except AttributeError:
 | 
				
			||||||
 | 
					            part_detail = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        kwargs['part_detail'] = part_detail
 | 
					        kwargs['part_detail'] = part_detail
 | 
				
			||||||
        kwargs['context'] = self.get_serializer_context()
 | 
					        kwargs['context'] = self.get_serializer_context()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -273,8 +273,12 @@ class BomList(generics.ListCreateAPIView):
 | 
				
			|||||||
    def get_serializer(self, *args, **kwargs):
 | 
					    def get_serializer(self, *args, **kwargs):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Do we wish to include extra detail?
 | 
					        # Do we wish to include extra detail?
 | 
				
			||||||
 | 
					        try:
 | 
				
			||||||
            part_detail = str2bool(self.request.GET.get('part_detail', None))
 | 
					            part_detail = str2bool(self.request.GET.get('part_detail', None))
 | 
				
			||||||
            sub_part_detail = str2bool(self.request.GET.get('sub_part_detail', None))
 | 
					            sub_part_detail = str2bool(self.request.GET.get('sub_part_detail', None))
 | 
				
			||||||
 | 
					        except AttributeError:
 | 
				
			||||||
 | 
					            part_detail = None
 | 
				
			||||||
 | 
					            sub_part_detail = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        kwargs['part_detail'] = part_detail
 | 
					        kwargs['part_detail'] = part_detail
 | 
				
			||||||
        kwargs['sub_part_detail'] = sub_part_detail
 | 
					        kwargs['sub_part_detail'] = sub_part_detail
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -261,8 +261,12 @@ class StockList(generics.ListCreateAPIView):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def get_serializer(self, *args, **kwargs):
 | 
					    def get_serializer(self, *args, **kwargs):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try:
 | 
				
			||||||
            part_detail = str2bool(self.request.GET.get('part_detail', None))
 | 
					            part_detail = str2bool(self.request.GET.get('part_detail', None))
 | 
				
			||||||
            location_detail = str2bool(self.request.GET.get('location_detail', None))
 | 
					            location_detail = str2bool(self.request.GET.get('location_detail', None))
 | 
				
			||||||
 | 
					        except AttributeError:
 | 
				
			||||||
 | 
					            part_detail = None
 | 
				
			||||||
 | 
					            location_detail = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        kwargs['part_detail'] = part_detail
 | 
					        kwargs['part_detail'] = part_detail
 | 
				
			||||||
        kwargs['location_detail'] = location_detail
 | 
					        kwargs['location_detail'] = location_detail
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user