Remove PreserveGetQuerySet mixin. Update SingleObjectList and

MultipleObjectFormActionView views to use a new get_object_list method.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-08-16 22:11:22 -04:00
parent c43f5eb66e
commit 2052caada4
39 changed files with 540 additions and 508 deletions

View File

@@ -5,7 +5,6 @@ import shutil
from django.test import override_settings
from acls.models import AccessControlList
from checkouts.models import NewVersionBlock
from common.tests.test_views import GenericViewTestCase
from common.utils import fs_cleanup, mkdtemp
@@ -80,10 +79,9 @@ class DocumentUploadTestCase(GenericDocumentViewTestCase):
# Create an access control entry giving the role the document
# create permission for the selected document type.
acl = AccessControlList.objects.create(
content_object=self.document_type, role=self.role
self.grant_access(
obj=self.document_type, permission=permission_document_create
)
acl.permissions.add(permission_document_create.stored_permission)
with open(TEST_SMALL_DOCUMENT_PATH) as file_object:
response = self.post(

View File

@@ -45,14 +45,6 @@ from .utils import get_class, get_form_class, get_upload_form_class
class SourceLogListView(SingleObjectListView):
view_permission = permission_sources_setup_view
def get_source(self):
return get_object_or_404(
Source.objects.select_subclasses(), pk=self.kwargs['pk']
)
def get_queryset(self):
return self.get_source().logs.all()
def get_extra_context(self):
return {
'hide_object': True,
@@ -60,6 +52,14 @@ class SourceLogListView(SingleObjectListView):
'title': _('Log entries for source: %s') % self.get_source(),
}
def get_object_list(self):
return self.get_source().logs.all()
def get_source(self):
return get_object_or_404(
Source.objects.select_subclasses(), pk=self.kwargs['pk']
)
class UploadBaseView(MultiFormView):
template_name = 'appearance/generic_form.html'