mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Style fixes
This commit is contained in:
parent
5b49cff09a
commit
e5f6de5d2b
@ -32,13 +32,6 @@ class PartParamList(generics.ListCreateAPIView):
|
||||
serializer_class = PartParameterSerializer
|
||||
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
# Ensure part link is set correctly
|
||||
part_id = self.request.query_params.get('part', None)
|
||||
if part_id:
|
||||
request.data['part'] = part_id
|
||||
return super(PartParamList, self).create(request, *args, **kwargs)
|
||||
|
||||
|
||||
class PartParamDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
""" Detail view of a single PartParameter
|
||||
|
@ -82,13 +82,6 @@ class ProjectPartsList(generics.ListCreateAPIView):
|
||||
|
||||
return parts
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
# Ensure project link is set correctly
|
||||
prj_id = self.request.query_params.get('project', None)
|
||||
if prj_id:
|
||||
request.data['project'] = prj_id
|
||||
return super(ProjectPartsList, self).create(request, *args, **kwargs)
|
||||
|
||||
|
||||
class ProjectPartDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
""" Detail for a single project part
|
||||
|
@ -45,13 +45,6 @@ class StockList(generics.ListCreateAPIView):
|
||||
|
||||
return items
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
# If the PART parameter is passed in the URL, use that
|
||||
part_id = self.request.query_params.get('part', None)
|
||||
if part_id:
|
||||
request.data['part'] = part_id
|
||||
return super(StockList, self).create(request, *args, **kwargs)
|
||||
|
||||
|
||||
class LocationDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
""" Return information on a specific stock location
|
||||
|
@ -80,7 +80,7 @@ class UniquePart(models.Model):
|
||||
|
||||
# Disallow saving a serial number that already exists
|
||||
matches = UniquePart.objects.filter(serial=self.serial, part=self.part)
|
||||
matches = matches.filter(~models.Q(id = self.id))
|
||||
matches = matches.filter(~models.Q(id=self.id))
|
||||
|
||||
if len(matches) > 0:
|
||||
raise ValidationError(_("Matching serial number already exists"))
|
||||
|
@ -20,7 +20,8 @@ class UniquePartFilter(django_filters.rest_framework.FilterSet):
|
||||
|
||||
class Meta:
|
||||
model = UniquePart
|
||||
fields = ['serial',]
|
||||
fields = ['serial', ]
|
||||
|
||||
|
||||
class UniquePartList(generics.ListCreateAPIView):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user