diff --git a/HISTORY.rst b/HISTORY.rst index 2ec23cd249..a8ac897e62 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,5 +1,6 @@ 4.0 (2019-XX-XX) ================ +<<<<<<< HEAD - Documents: Add a server side template for invalid documents. The new template can be accessed via the templates API. Improve the way invalid documents are detected in the JavaScript @@ -255,7 +256,8 @@ (http://jinja.pocoo.org/docs/2.10/templates/#math). - Reject emails attachments of size 0. Thanks to Robert Schoeftner (@robert.schoeftner)for the report and solution. GitLab issue #574. - +- Fix multiple tag selection wizard step. + 3.1.9 (2018-11-01) ================== diff --git a/docs/releases/3.2.rst b/docs/releases/3.2.rst index e8bda48c1b..d8a6409058 100644 --- a/docs/releases/3.2.rst +++ b/docs/releases/3.2.rst @@ -7,6 +7,24 @@ Released: XX XX, 2019 Changes ------- +Switch to full app paths +^^^^^^^^^^^^^^^^^^^^^^^^ +Instead of inserting the path of the apps into the Python app, +the apps are now referenced by their full import path. + +This solves name clashes with external or native Python libraries. +Example: Mayan statistics app vs. Python new statistics library. + +Every app reference is now prepended with 'mayan.apps'. + +Existing config.yml files need to be updated manually. + + +Other changes +^^^^^^^^^^^^^ + +* Split source models into different modules. +* Fix multiple tag selection wizard step. Removals -------- diff --git a/mayan/apps/tags/tests/literals.py b/mayan/apps/tags/tests/literals.py index 1c08f4765b..5ad95401b9 100644 --- a/mayan/apps/tags/tests/literals.py +++ b/mayan/apps/tags/tests/literals.py @@ -1,10 +1,10 @@ from __future__ import unicode_literals TEST_TAG_LABEL = 'test-tag' +TEST_TAG_LABEL_2 = 'test-tag-2' TEST_TAG_LABEL_EDITED = 'test-tag-edited' TEST_TAG_COLOR = '#001122' TEST_TAG_COLOR_EDITED = '#221100' - TEST_TAG_INDEX_HAS_TAG = 'HAS_TAG' TEST_TAG_INDEX_NO_TAG = 'NO_TAG' TEST_TAG_INDEX_NODE_TEMPLATE = ''' diff --git a/mayan/apps/tags/tests/mixins.py b/mayan/apps/tags/tests/mixins.py index 2b4b1dd6f4..423f232153 100644 --- a/mayan/apps/tags/tests/mixins.py +++ b/mayan/apps/tags/tests/mixins.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from ..models import Tag from .literals import ( - TEST_TAG_COLOR, TEST_TAG_COLOR_EDITED, TEST_TAG_LABEL, + TEST_TAG_COLOR, TEST_TAG_COLOR_EDITED, TEST_TAG_LABEL, TEST_TAG_LABEL_2 TEST_TAG_LABEL_EDITED ) @@ -14,6 +14,11 @@ class TagTestMixin(object): color=TEST_TAG_COLOR, label=TEST_TAG_LABEL ) + def _create_test_tag_2(self): + self.test_tag_2 = Tag.objects.create( + color=TEST_TAG_COLOR, label=TEST_TAG_LABEL_2 + ) + class TagAPITestMixin(object): def _request_api_tag_create_view(self): diff --git a/mayan/apps/tags/tests/test_wizard_steps.py b/mayan/apps/tags/tests/test_wizard_steps.py index 5567b6b558..e1cfd6efce 100644 --- a/mayan/apps/tags/tests/test_wizard_steps.py +++ b/mayan/apps/tags/tests/test_wizard_steps.py @@ -15,6 +15,8 @@ from .mixins import TagTestMixin class TaggedDocumentUploadTestCase(TagTestMixin, GenericDocumentViewTestCase): + auto_upload_document = False + def setUp(self): super(TaggedDocumentUploadTestCase, self).setUp() self.source = WebFormSource.objects.create( @@ -22,8 +24,6 @@ class TaggedDocumentUploadTestCase(TagTestMixin, GenericDocumentViewTestCase): uncompress=TEST_SOURCE_UNCOMPRESS_N ) - self.document.delete() - def _request_upload_interactive_document_create_view(self): with open(TEST_SMALL_DOCUMENT_PATH, mode='rb') as file_object: return self.post( @@ -32,15 +32,30 @@ class TaggedDocumentUploadTestCase(TagTestMixin, GenericDocumentViewTestCase): data={ 'document_type_id': self.document_type.pk, 'source-file': file_object, - 'tags': self.test_tag.pk + 'tags': ','.join(map(str, Tag.objects.values_list('pk', flat=True))) } ) def test_upload_interactive_view_with_access(self): - self._create_test_tag() + self._create_tag() + self.grant_access( permission=permission_document_create, obj=self.document_type ) response = self._request_upload_interactive_document_create_view() self.assertEqual(response.status_code, 302) + + self.assertTrue(self.tag in Document.objects.first().tags.all()) + + def test_upload_interactive_multiple_tags_view_with_access(self): + self._create_tag() + self._create_tag_2() + + self.grant_access( + permission=permission_document_create, obj=self.document_type + ) + response = self._request_upload_interactive_document_create_view() + self.assertEqual(response.status_code, 302) + self.assertTrue(self.test_tag in Document.objects.first().tags.all()) + self.assertTrue(self.test_tag_2 in Document.objects.first().tags.all()) diff --git a/mayan/apps/tags/wizard_steps.py b/mayan/apps/tags/wizard_steps.py index ab392e5fea..11bc63c822 100644 --- a/mayan/apps/tags/wizard_steps.py +++ b/mayan/apps/tags/wizard_steps.py @@ -49,7 +49,7 @@ class WizardStepTags(WizardStep): furl_instance = furl(args=querystring) Tag = apps.get_model(app_label='tags', model_name='Tag') - for tag in Tag.objects.filter(pk__in=furl_instance.args.getlist('tags')): + for tag in Tag.objects.filter(pk__in=furl_instance.args['tags'].split(',')): tag.documents.add(document)