Add keyword arguments to CT get_for_model
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user