Fix multiple tag selection wizard step

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-04-06 02:08:22 -04:00
parent d493ec34b2
commit daca9dd539
6 changed files with 117 additions and 5 deletions

View File

@@ -1,3 +1,7 @@
3.1.11 (2019-04-XX)
===================
* Fix multiple tag selection wizard step.
3.1.10 (2019-04-04)
===================
* Backport test case improvements from the development branch. Add random

85
docs/releases/3.1.11.rst Normal file
View File

@@ -0,0 +1,85 @@
Version 3.1.11
==============
Released: April XX, 2019
Changes
-------
Other changes
^^^^^^^^^^^^^
* Fix multiple tag selection wizard step.
Removals
--------
* None
Upgrading from a previous version
---------------------------------
If installed via Python's PIP
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Remove deprecated requirements::
$ curl https://gitlab.com/mayan-edms/mayan-edms/raw/master/removals.txt | pip uninstall -r /dev/stdin
Type in the console::
$ pip install mayan-edms==3.1.11
the requirements will also be updated automatically.
Using Git
^^^^^^^^^
If you installed Mayan EDMS by cloning the Git repository issue the commands::
$ git reset --hard HEAD
$ git pull
otherwise download the compressed archived and uncompress it overriding the
existing installation.
Remove deprecated requirements::
$ pip uninstall -y -r removals.txt
Next upgrade/add the new requirements::
$ pip install --upgrade -r requirements.txt
Common steps
^^^^^^^^^^^^
Perform these steps after updating the code from either step above.
Migrate existing database schema with::
$ mayan-edms.py performupgrade
Add new static media::
$ mayan-edms.py collectstatic --noinput
The upgrade procedure is now complete.
Backward incompatible changes
-----------------------------
* None
Bugs fixed or issues closed
---------------------------
* :gitlab-issue:`563` Recursive Watch Folder
.. _PyPI: https://pypi.python.org/pypi/mayan-edms/

View File

@@ -20,6 +20,7 @@ versions of the documentation contain the release notes for any later releases.
.. toctree::
:maxdepth: 1
3.1.11
3.1.10
3.1.9
3.1.8

View File

@@ -5,6 +5,8 @@ TEST_TAG_LABEL_EDITED = 'test-tag-edited'
TEST_TAG_COLOR = '#001122'
TEST_TAG_COLOR_EDITED = '#221100'
TEST_TAG_LABEL_2 = 'test-tag-2'
TEST_TAG_INDEX_HAS_TAG = 'HAS_TAG'
TEST_TAG_INDEX_NO_TAG = 'NO_TAG'
TEST_TAG_INDEX_NODE_TEMPLATE = '''

View File

@@ -12,10 +12,12 @@ from sources.tests.literals import (
from ..models import Tag
from .literals import TEST_TAG_COLOR, TEST_TAG_LABEL
from .literals import TEST_TAG_COLOR, TEST_TAG_LABEL, TEST_TAG_LABEL_2
class TaggedDocumentUploadTestCase(GenericDocumentViewTestCase):
auto_upload_document = False
def setUp(self):
super(TaggedDocumentUploadTestCase, self).setUp()
self.login_user()
@@ -24,8 +26,6 @@ class TaggedDocumentUploadTestCase(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(
@@ -33,7 +33,7 @@ class TaggedDocumentUploadTestCase(GenericDocumentViewTestCase):
data={
'document_type_id': self.document_type.pk,
'source-file': file_object,
'tags': self.tag.pk
'tags': ','.join(map(str, Tag.objects.values_list('pk', flat=True)))
}
)
@@ -42,11 +42,31 @@ class TaggedDocumentUploadTestCase(GenericDocumentViewTestCase):
color=TEST_TAG_COLOR, label=TEST_TAG_LABEL
)
def _create_tag_2(self):
self.tag_2 = Tag.objects.create(
color=TEST_TAG_COLOR, label=TEST_TAG_LABEL_2
)
def test_upload_interactive_view_with_access(self):
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.tag in Document.objects.first().tags.all())
self.assertTrue(self.tag_2 in Document.objects.first().tags.all())

View File

@@ -45,7 +45,7 @@ class WizardStepTags(WizardStep):
furl_instance = furl(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)