Add keyword arguments to get_object_or_404 uses

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-04-11 20:53:33 -04:00
parent 456c322c19
commit f6f9287e33
38 changed files with 169 additions and 153 deletions
+3 -3
View File
@@ -33,7 +33,7 @@ class APIDocumentCabinetListView(generics.ListAPIView):
mayan_object_permissions = {'GET': (permission_cabinet_view,)}
def get_queryset(self):
document = get_object_or_404(Document, pk=self.kwargs['pk'])
document = get_object_or_404(klass=Document, pk=self.kwargs['pk'])
AccessControlList.objects.check_access(
permissions=permission_document_view, user=self.request.user,
obj=document
@@ -135,7 +135,7 @@ class APICabinetDocumentListView(generics.ListCreateAPIView):
return context
def get_cabinet(self):
return get_object_or_404(Cabinet, pk=self.kwargs['pk'])
return get_object_or_404(klass=Cabinet, pk=self.kwargs['pk'])
def get_queryset(self):
cabinet = self.get_cabinet()
@@ -163,7 +163,7 @@ class APICabinetDocumentView(generics.RetrieveDestroyAPIView):
serializer_class = CabinetDocumentSerializer
def get_cabinet(self):
return get_object_or_404(Cabinet, pk=self.kwargs['pk'])
return get_object_or_404(klass=Cabinet, pk=self.kwargs['pk'])
def get_queryset(self):
return self.get_cabinet().documents.all()