mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Handle case where user is not specified
This commit is contained in:
parent
bfb32f3bf6
commit
15a0d260f8
@ -72,7 +72,7 @@ class StockDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
def get_serializer_context(self):
|
||||
|
||||
ctx = super().get_serializer_context()
|
||||
ctx['user'] = self.request.user
|
||||
ctx['user'] = getattr(self.request, 'user', None)
|
||||
|
||||
return ctx
|
||||
|
||||
@ -392,7 +392,7 @@ class StockList(generics.ListCreateAPIView):
|
||||
def get_serializer_context(self):
|
||||
|
||||
ctx = super().get_serializer_context()
|
||||
ctx['user'] = self.request.user
|
||||
ctx['user'] = getattr(self.request, 'user', None)
|
||||
|
||||
return ctx
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user