Fix document type change view

Closes GitLab issue #614. Thanks to Christoph Roeder (@brightdroid)
for the report.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-06-18 22:15:13 -04:00
parent 43260b87c5
commit c3b1c4e173
6 changed files with 143 additions and 6 deletions

View File

@@ -1,3 +1,8 @@
3.2.2 (2019-06-XX)
==================
* Fix document type change view. Closes GitLab issue #614
Thanks to Christoph Roeder (@brightdroid) for the report.
3.2.1 (2019-06-14)
==================
* Fix sub cabinet creation view. Thanks to Frédéric Sheedy

102
docs/releases/3.2.2.rst Normal file
View File

@@ -0,0 +1,102 @@
Version 3.2.2
=============
Released: June 17, 2019
Changes
-------
- Fix document type change view. Closes GitLab issue #614.
Thanks to Christoph Roeder (@brightdroid) for the report.
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.2.1
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.
Make a backup of your supervisord file::
sudo cp /etc/supervisor/conf.d/mayan.conf /etc/supervisor/conf.d/mayan.conf.bck
Update the supervisord configuration file. Replace the environment
variables values show here with your respective settings. This step will refresh
the supervisord configuration file with the new queues and the latest
recommended layout::
MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=mayan \
MAYAN_DATABASE_PASSWORD=mayanuserpass MAYAN_DATABASE_USER=mayan \
MAYAN_DATABASE_HOST=127.0.0.1 MAYAN_MEDIA_ROOT=/opt/mayan-edms/media \
/opt/mayan-edms/bin/mayan-edms.py platformtemplate supervisord > /etc/supervisor/conf.d/mayan.conf
Edit the supervisord configuration file and update any setting the template
generator missed::
vi /etc/supervisor/conf.d/mayan.conf
Migrate existing database schema with::
$ mayan-edms.py performupgrade
Add new static media::
$ mayan-edms.py preparestatic --noinput
The upgrade procedure is now complete.
Backward incompatible changes
-----------------------------
- None
Bugs fixed or issues closed
---------------------------
- :gitlab-issue:`614` change type exception
.. _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.2.2
3.2.1
3.2
3.1.11

View File

@@ -154,7 +154,13 @@ class DocumentViewTestMixin(object):
def _request_test_document_list_view(self):
return self.get(viewname='documents:document_list')
def _request_test_document_type_edit_view(self, document_type):
def _request_test_document_type_edit_get_view(self):
return self.get(
viewname='documents:document_document_type_edit',
kwargs={'pk': self.test_document.pk}
)
def _request_test_document_type_edit_post_view(self, document_type):
return self.post(
viewname='documents:document_document_type_edit',
kwargs={'pk': self.test_document.pk},

View File

@@ -53,7 +53,7 @@ class DocumentsViewsTestCase(DocumentViewTestMixin, GenericDocumentViewTestCase)
response=response, text=self.test_document.label, status_code=200
)
def test_document_document_type_change_view_no_permissions(self):
def test_document_document_type_change_post_view_no_permissions(self):
self.assertEqual(
self.test_document.document_type, self.test_document_type
)
@@ -62,7 +62,7 @@ class DocumentsViewsTestCase(DocumentViewTestMixin, GenericDocumentViewTestCase)
label=TEST_DOCUMENT_TYPE_2_LABEL
)
response = self._request_test_document_type_edit_view(
response = self._request_test_document_type_edit_post_view(
document_type=document_type_2
)
self.assertEqual(response.status_code, 404)
@@ -72,7 +72,7 @@ class DocumentsViewsTestCase(DocumentViewTestMixin, GenericDocumentViewTestCase)
self.test_document_type
)
def test_document_document_type_change_view_with_permissions(self):
def test_document_document_type_change_post_view_with_permissions(self):
self.assertEqual(
self.test_document.document_type, self.test_document_type
)
@@ -88,7 +88,7 @@ class DocumentsViewsTestCase(DocumentViewTestMixin, GenericDocumentViewTestCase)
obj=document_type_2, permission=permission_document_create
)
response = self._request_test_document_type_edit_view(
response = self._request_test_document_type_edit_post_view(
document_type=document_type_2
)
self.assertEqual(response.status_code, 302)
@@ -98,6 +98,29 @@ class DocumentsViewsTestCase(DocumentViewTestMixin, GenericDocumentViewTestCase)
document_type_2
)
def test_document_document_type_change_view_get_no_permissions(self):
response = self._request_test_document_type_edit_get_view(
)
self.assertEqual(response.status_code, 404)
self.assertEqual(
Document.objects.get(pk=self.test_document.pk).document_type,
self.test_document_type
)
def test_document_document_type_change_view_get_with_permissions(self):
self.grant_access(
obj=self.test_document, permission=permission_document_properties_edit
)
response = self._request_test_document_type_edit_get_view(
)
self.assertEqual(response.status_code, 200)
self.assertEqual(
Document.objects.get(pk=self.test_document.pk).document_type,
self.test_document_type
)
def test_document_multiple_document_type_change_view_no_permission(self):
self.assertEqual(
Document.objects.first().document_type, self.test_document_type

View File

@@ -117,7 +117,7 @@ class DocumentDocumentTypeEditView(MultipleObjectFormActionView):
'submit_label': _('Change'),
'title': ungettext(
singular='Change the type of the selected document',
plurals='Change the type of the selected documents',
plural='Change the type of the selected documents',
number=queryset.count()
)
}