Fix sub cabinet creation view
Thanks to Frédéric Sheedy (@fsheedy) for the report. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
103
docs/releases/3.2.1.rst
Normal file
103
docs/releases/3.2.1.rst
Normal file
@@ -0,0 +1,103 @@
|
||||
Version 3.2.1
|
||||
=============
|
||||
|
||||
Released: June 14, 2019
|
||||
|
||||
|
||||
|
||||
Changes
|
||||
-------
|
||||
|
||||
- Fix sub cabinet creation view.
|
||||
|
||||
|
||||
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:`601` Error when creating new cabinet level
|
||||
|
||||
.. _PyPI: https://pypi.python.org/pypi/mayan-edms/
|
||||
@@ -20,6 +20,7 @@ versions of the documentation contain the release notes for any later releases.
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
3.2.1
|
||||
3.2
|
||||
3.1.11
|
||||
3.1.10
|
||||
|
||||
@@ -56,8 +56,14 @@ class CabinetAPIViewTestMixin(object):
|
||||
|
||||
|
||||
class CabinetTestMixin(object):
|
||||
def setUp(self):
|
||||
super(CabinetTestMixin, self).setUp()
|
||||
if not hasattr(self, 'test_cabinets'):
|
||||
self.test_cabinets = []
|
||||
|
||||
def _create_test_cabinet(self):
|
||||
self.test_cabinet = Cabinet.objects.create(label=TEST_CABINET_LABEL)
|
||||
self.test_cabinets.append(self.test_cabinet)
|
||||
|
||||
def _create_test_cabinet_child(self):
|
||||
self.test_cabinet_child = Cabinet.objects.create(
|
||||
@@ -66,6 +72,11 @@ class CabinetTestMixin(object):
|
||||
|
||||
|
||||
class CabinetViewTestMixin(object):
|
||||
def setUp(self):
|
||||
super(CabinetViewTestMixin, self).setUp()
|
||||
if not hasattr(self, 'test_cabinets'):
|
||||
self.test_cabinets = []
|
||||
|
||||
def _request_test_cabinet_create_view(self):
|
||||
# Typecast to list to force queryset evaluation
|
||||
values = list(Cabinet.objects.values_list('pk', flat=True))
|
||||
@@ -77,6 +88,7 @@ class CabinetViewTestMixin(object):
|
||||
)
|
||||
|
||||
self.test_cabinet = Cabinet.objects.exclude(pk__in=values).first()
|
||||
self.test_cabinets.append(self.test_cabinet)
|
||||
|
||||
return response
|
||||
|
||||
@@ -97,12 +109,20 @@ class CabinetViewTestMixin(object):
|
||||
)
|
||||
|
||||
def _request_test_cabinet_child_create_view(self):
|
||||
return self.post(
|
||||
# Typecast to list to force queryset evaluation
|
||||
values = list(Cabinet.objects.values_list('pk', flat=True))
|
||||
|
||||
response = self.post(
|
||||
viewname='cabinets:cabinet_child_add', kwargs={
|
||||
'pk': self.test_cabinet.pk
|
||||
}, data={'label': TEST_CABINET_CHILD_LABEL}
|
||||
)
|
||||
|
||||
self.test_cabinet = Cabinet.objects.exclude(pk__in=values).first()
|
||||
self.test_cabinets.append(self.test_cabinet)
|
||||
|
||||
return response
|
||||
|
||||
def _request_test_cabinet_child_delete_view(self):
|
||||
return self.post(
|
||||
viewname='cabinets:cabinet_delete', kwargs={
|
||||
|
||||
@@ -127,7 +127,11 @@ class CabinetChildViewTestCase(CabinetTestMixin, CabinetViewTestMixin, GenericVi
|
||||
response = self._request_test_cabinet_child_create_view()
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
self.test_cabinets[0].refresh_from_db()
|
||||
self.assertEqual(Cabinet.objects.count(), cabinet_count + 1)
|
||||
self.assertTrue(
|
||||
self.test_cabinets[1] in self.test_cabinets[0].get_descendants()
|
||||
)
|
||||
|
||||
def test_cabinet_child_delete_view_no_permission(self):
|
||||
self._create_test_cabinet_child()
|
||||
|
||||
@@ -62,12 +62,16 @@ class CabinetChildAddView(ExternalObjectMixin, SingleObjectCreateView):
|
||||
'object': self.external_object
|
||||
}
|
||||
|
||||
def get_instance_extra_data(self):
|
||||
return {
|
||||
'parent': self.external_object,
|
||||
}
|
||||
|
||||
def get_queryset(self):
|
||||
return self.external_object.get_descendants()
|
||||
|
||||
def get_save_extra_data(self):
|
||||
return {
|
||||
'parent': self.external_object,
|
||||
'_user': self.request.user
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user