Thanks, unit testing
This commit is contained in:
Oliver Walters 2020-04-06 11:21:34 +10:00
parent b28487760a
commit bbe714c8f7
3 changed files with 10 additions and 6 deletions

View File

@ -61,11 +61,15 @@ class StockDetail(generics.RetrieveUpdateDestroyAPIView):
def get_serializer(self, *args, **kwargs):
part_detail = str2bool(self.request.GET.get('part_detail', False))
loc_detail = str2bool(self.request.GET.get('location_detail', False))
try:
kwargs['part_detail'] = str2bool(self.request.GET.get('part_detail', False))
except AttributeError:
pass
kwargs['part_detail'] = part_detail
kwargs['location_detail'] = loc_detail
try:
kwargs['location_detail'] = str2bool(self.request.GET.get('location_detail', False))
except AttributeError:
pass
kwargs['context'] = self.get_serializer_context()

View File

@ -427,7 +427,7 @@ class StockItem(MPTTModel):
quantity=self.quantity,
date=datetime.now().date(),
notes=notes,
URL=url,
link=url,
system=system
)

View File

@ -934,7 +934,7 @@ class StockItemCreate(AjaxCreateView):
batch=form_data.get('batch'),
delete_on_deplete=False,
status=form_data.get('status'),
URL=form_data.get('URL'),
link=form_data.get('link'),
)
item.save(user=request.user)