Fix cabinet and tags upload wizard steps

Steps were missing some entries. Closes GitLab issue #632.
Thanks to Matthias Urhahn (@d4rken) for the report.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-07-05 00:28:01 -04:00
parent b8345797d6
commit 2af03eeca8
12 changed files with 174 additions and 94 deletions
+9 -8
View File
@@ -1,9 +1,8 @@
from __future__ import unicode_literals
from furl import furl
from django.shortcuts import get_object_or_404
from django.utils.encoding import force_bytes
from mayan.apps.common.http import URL
from .models import DocumentMetadata, MetadataType
@@ -19,7 +18,7 @@ def decode_metadata_from_querystring(querystring=None):
metadata_list = []
if querystring:
# Match out of order metadata_type ids with metadata values from request
for key, value in furl(force_bytes(querystring)).args.items():
for key, value in URL(query_string=querystring).args.items():
if 'metadata' in key:
index, element = key[8:].split('_')
metadata_dict[element][index] = value
@@ -27,10 +26,12 @@ def decode_metadata_from_querystring(querystring=None):
# Convert the nested dictionary into a list of id+values dictionaries
for order, identifier in metadata_dict['id'].items():
if order in metadata_dict['value'].keys():
metadata_list.append({
'id': identifier,
'value': metadata_dict['value'][order]
})
metadata_list.append(
{
'id': identifier,
'value': metadata_dict['value'][order]
}
)
return metadata_list