From 76b75af1c2237f40d0418878e7aec85bd959c33c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 10 May 2019 00:39:20 -0400 Subject: [PATCH] Add keyword arguments to CT get_for_model Signed-off-by: Roberto Rosario --- mayan/apps/acls/serializers.py | 2 +- mayan/apps/common/links.py | 2 +- mayan/apps/converter/managers.py | 4 ++-- mayan/apps/documents/tests/test_document_views.py | 8 ++++---- mayan/apps/events/links.py | 2 +- mayan/apps/events/tests/test_views.py | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mayan/apps/acls/serializers.py b/mayan/apps/acls/serializers.py index 835a7e8cc4..8d16b5d23a 100644 --- a/mayan/apps/acls/serializers.py +++ b/mayan/apps/acls/serializers.py @@ -171,7 +171,7 @@ class WritableAccessControlListSerializer(serializers.ModelSerializer): def validate(self, attrs): attrs['content_type'] = ContentType.objects.get_for_model( - self.context['content_object'] + model=self.context['content_object'] ) attrs['object_id'] = self.context['content_object'].pk diff --git a/mayan/apps/common/links.py b/mayan/apps/common/links.py index 51c98e164d..25a74bf903 100644 --- a/mayan/apps/common/links.py +++ b/mayan/apps/common/links.py @@ -21,7 +21,7 @@ def get_kwargs_factory(variable_name): ) content_type = ContentType.objects.get_for_model( - context[variable_name] + model=context[variable_name] ) return { 'app_label': '"{}"'.format(content_type.app_label), diff --git a/mayan/apps/converter/managers.py b/mayan/apps/converter/managers.py index 444907cac1..392c80c7aa 100644 --- a/mayan/apps/converter/managers.py +++ b/mayan/apps/converter/managers.py @@ -45,7 +45,7 @@ class TransformationManager(models.Manager): lambda entry: { 'content_type': entry[0], 'object_id': entry[1] }, zip( - ContentType.objects.get_for_models(*targets).values(), + ContentType.objects.get_for_models(models=targets).values(), targets.values_list('pk', flat=True) ) ) @@ -72,7 +72,7 @@ class TransformationManager(models.Manager): as_classes == True returns the transformation classes from .classes ready to be feed to the converter class """ - content_type = ContentType.objects.get_for_model(obj) + content_type = ContentType.objects.get_for_model(model=obj) transformations = self.filter( content_type=content_type, object_id=obj.pk diff --git a/mayan/apps/documents/tests/test_document_views.py b/mayan/apps/documents/tests/test_document_views.py index f352ebfc17..0eb9614d7d 100644 --- a/mayan/apps/documents/tests/test_document_views.py +++ b/mayan/apps/documents/tests/test_document_views.py @@ -306,7 +306,7 @@ class DocumentsViewsTestCase(DocumentViewTestMixin, GenericDocumentViewTestCase) def test_document_clear_transformations_view_no_permission(self): document_page = self.test_document.pages.first() - content_type = ContentType.objects.get_for_model(document_page) + content_type = ContentType.objects.get_for_model(model=document_page) transformation = Transformation.objects.create( content_type=content_type, object_id=document_page.pk, name=TEST_TRANSFORMATION_NAME, @@ -332,7 +332,7 @@ class DocumentsViewsTestCase(DocumentViewTestMixin, GenericDocumentViewTestCase) def test_document_clear_transformations_view_with_access(self): document_page = self.test_document.pages.first() - content_type = ContentType.objects.get_for_model(document_page) + content_type = ContentType.objects.get_for_model(model=document_page) transformation = Transformation.objects.create( content_type=content_type, object_id=document_page.pk, name=TEST_TRANSFORMATION_NAME, @@ -359,7 +359,7 @@ class DocumentsViewsTestCase(DocumentViewTestMixin, GenericDocumentViewTestCase) def test_document_multiple_clear_transformations_view_no_permission(self): document_page = self.test_document.pages.first() - content_type = ContentType.objects.get_for_model(document_page) + content_type = ContentType.objects.get_for_model(model=document_page) transformation = Transformation.objects.create( content_type=content_type, object_id=document_page.pk, name=TEST_TRANSFORMATION_NAME, @@ -382,7 +382,7 @@ class DocumentsViewsTestCase(DocumentViewTestMixin, GenericDocumentViewTestCase) def test_document_multiple_clear_transformations_view_with_access(self): document_page = self.test_document.pages.first() - content_type = ContentType.objects.get_for_model(document_page) + content_type = ContentType.objects.get_for_model(model=document_page) transformation = Transformation.objects.create( content_type=content_type, object_id=document_page.pk, name=TEST_TRANSFORMATION_NAME, diff --git a/mayan/apps/events/links.py b/mayan/apps/events/links.py index 8ba0b163b4..0c2815fb10 100644 --- a/mayan/apps/events/links.py +++ b/mayan/apps/events/links.py @@ -21,7 +21,7 @@ def get_kwargs_factory(variable_name): ) content_type = ContentType.objects.get_for_model( - context[variable_name] + model=context[variable_name] ) return { 'app_label': '"{}"'.format(content_type.app_label), diff --git a/mayan/apps/events/tests/test_views.py b/mayan/apps/events/tests/test_views.py index 37fce97fea..c600524f6f 100644 --- a/mayan/apps/events/tests/test_views.py +++ b/mayan/apps/events/tests/test_views.py @@ -15,7 +15,7 @@ class EventsViewTestCase(GenericDocumentViewTestCase): super(EventsViewTestCase, self).setUp() self.test_object = self.test_document_type - content_type = ContentType.objects.get_for_model(self.test_object) + content_type = ContentType.objects.get_for_model(model=self.test_object) self.view_arguments = { 'app_label': content_type.app_label,