Fix multiple tag selection wizard step
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
committed by
Roberto Rosario
parent
97fb5f96a7
commit
4d8dc8e552
@@ -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)
|
||||
==================
|
||||
|
||||
@@ -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
|
||||
--------
|
||||
|
||||
@@ -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 = '''
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user