Remove transformation manager methods

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-04-27 02:21:19 -04:00
parent 89bc78bd55
commit cd5bc8ba4b
9 changed files with 35 additions and 27 deletions

View File

@@ -165,7 +165,7 @@ class DocumentPage(models.Model):
transformation_list = []
# Stored transformations first
for stored_transformation in Transformation.objects.get_for_model(self, as_classes=True):
for stored_transformation in Transformation.objects.get_for_object(self, as_classes=True):
transformation_list.append(stored_transformation)
# Interactive transformations second

View File

@@ -143,7 +143,7 @@ class DocumentVersion(models.Model):
for page in self.pages.all():
degrees = page.detect_orientation()
if degrees:
Transformation.objects.add_for_model(
Transformation.objects.add_to_object(
obj=page, transformation=TransformationRotate,
arguments='{{"degrees": {}}}'.format(360 - degrees)
)

View File

@@ -388,7 +388,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
)
self.assertQuerysetEqual(
Transformation.objects.get_for_model(document_page),
Transformation.objects.get_for_object(obj=document_page),
(repr(transformation),)
)
@@ -400,7 +400,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
self.assertEqual(response.status_code, 302)
self.assertQuerysetEqual(
Transformation.objects.get_for_model(document_page),
Transformation.objects.get_for_object(obj=document_page),
(repr(transformation),)
)
@@ -413,7 +413,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
arguments=TEST_TRANSFORMATION_ARGUMENT
)
self.assertQuerysetEqual(
Transformation.objects.get_for_model(document_page),
Transformation.objects.get_for_object(obj=document_page),
(repr(transformation),)
)
@@ -428,7 +428,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
self.assertEqual(response.status_code, 302)
self.assertEqual(
Transformation.objects.get_for_model(document_page).count(), 0
Transformation.objects.get_for_object(obj=document_page).count(), 0
)
def _request_document_multiple_clear_transformations(self):
@@ -447,7 +447,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
)
self.assertQuerysetEqual(
Transformation.objects.get_for_model(document_page),
Transformation.objects.get_for_object(obj==document_page),
(repr(transformation),)
)
@@ -456,7 +456,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
response = self._request_document_multiple_clear_transformations()
self.assertEqual(response.status_code, 302)
self.assertQuerysetEqual(
Transformation.objects.get_for_model(document_page),
Transformation.objects.get_for_object(obj=document_page),
(repr(transformation),)
)
@@ -470,7 +470,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
)
self.assertQuerysetEqual(
Transformation.objects.get_for_model(document_page),
Transformation.objects.get_for_object(obj=document_page),
(repr(transformation),)
)
@@ -485,7 +485,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
self.assertEqual(response.status_code, 302)
self.assertEqual(
Transformation.objects.get_for_model(document_page).count(), 0
Transformation.objects.get_for_object(obj=document_page).count(), 0
)
def _request_empty_trash_view(self):

View File

@@ -515,7 +515,7 @@ class DocumentTransformationsClearView(MultipleObjectConfirmActionView):
def object_action(self, form, instance):
try:
for page in instance.pages.all():
Transformation.objects.get_for_model(page).delete()
Transformation.objects.get_for_object(obj=page).delete()
except Exception as exception:
messages.error(
self.request, _(
@@ -539,7 +539,7 @@ class DocumentTransformationsCloneView(FormView):
)
for page in target_pages:
Transformation.objects.get_for_model(page).delete()
Transformation.objects.get_for_object(obj=page).delete()
Transformation.objects.copy(
source=form.cleaned_data['page'], targets=target_pages