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

View File

@@ -111,7 +111,7 @@ class DeletedDocumentDeleteView(ConfirmView):
def object_action(self, instance):
source_document = get_object_or_404(
Document.passthrough, pk=instance.pk
klass=Document.passthrough, pk=instance.pk
)
AccessControlList.objects.check_access(
@@ -124,7 +124,9 @@ class DeletedDocumentDeleteView(ConfirmView):
)
def view_action(self):
instance = get_object_or_404(DeletedDocument, pk=self.kwargs['pk'])
instance = get_object_or_404(
klass=DeletedDocument, pk=self.kwargs['pk']
)
self.object_action(instance=instance)
messages.success(
self.request, _('Document: %(document)s deleted.') % {
@@ -237,7 +239,7 @@ class DocumentDuplicatesListView(DocumentListView):
).dispatch(request, *args, **kwargs)
def get_document(self):
return get_object_or_404(Document, pk=self.kwargs['pk'])
return get_object_or_404(klass=Document, pk=self.kwargs['pk'])
def get_extra_context(self):
context = super(DocumentDuplicatesListView, self).get_extra_context()
@@ -326,7 +328,7 @@ class DocumentRestoreView(ConfirmView):
def object_action(self, instance):
source_document = get_object_or_404(
Document.passthrough, pk=instance.pk
klass=Document.passthrough, pk=instance.pk
)
AccessControlList.objects.check_access(
@@ -337,7 +339,9 @@ class DocumentRestoreView(ConfirmView):
instance.restore()
def view_action(self):
instance = get_object_or_404(DeletedDocument, pk=self.kwargs['pk'])
instance = get_object_or_404(
klass=DeletedDocument, pk=self.kwargs['pk']
)
self.object_action(instance=instance)
@@ -365,7 +369,7 @@ class DocumentTrashView(ConfirmView):
}
def get_object(self):
return get_object_or_404(Document, pk=self.kwargs['pk'])
return get_object_or_404(klass=Document, pk=self.kwargs['pk'])
def get_post_action_redirect(self):
return reverse('documents:document_list_recent_access')
@@ -751,7 +755,7 @@ class DocumentTransformationsCloneView(FormView):
return context
def get_object(self):
instance = get_object_or_404(Document, pk=self.kwargs['pk'])
instance = get_object_or_404(klass=Document, pk=self.kwargs['pk'])
AccessControlList.objects.check_access(
permissions=permission_transformation_edit,
@@ -824,7 +828,7 @@ class DocumentPrint(FormView):
return context
def get_object(self):
return get_object_or_404(Document, pk=self.kwargs['pk'])
return get_object_or_404(klass=Document, pk=self.kwargs['pk'])
def get_template_names(self):
if self.page_group or self.page_range: