Add multiple metadata not possible
Hi Roberto when I try to add multiple metadata i get the following error:
ValueError at /metadata/multiple/edit/
invalid literal for int() with base 10: "['530'"
Request Method: GET
Request URL: http://htpc/metadata/multiple/edit/?id_list=%5B%27530%27%2C+%27529%27%5D&next=http%3A%2F%2Fhtpc%2Fdocuments%2Flist%2F
Django Version: 1.7.10
Exception Type: ValueError
Exception Value:
invalid literal for int() with base 10: "['530'"
Exception Location: /home/elem/pythonenvs/mayan11/lib/python2.7/site-packages/django/db/models/fields/__init__.py in get_prep_value, line 915
Python Executable: /home/elem/pythonenvs/mayan11/bin/python
Python Version: 2.7.6
Python Path:
['/home/elem/pythonenvs/mayan11/lib/python2.7/site-packages',
'/home/elem/pythonenvs/mayan11/bin',
'/home/elem/pythonenvs/mayan11/lib/python2.7',
'/home/elem/pythonenvs/mayan11/lib/python2.7/plat-x86_64-linux-gnu',
'/home/elem/pythonenvs/mayan11/lib/python2.7/lib-tk',
'/home/elem/pythonenvs/mayan11/lib/python2.7/lib-old',
'/home/elem/pythonenvs/mayan11/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/home/elem/pythonenvs/mayan11/local/lib/python2.7/site-packages',
u'/home/elem/pythonenvs/mayan11/lib/python2.7/site-packages/mayan/apps',
'/home/elem/pythonenvs/mayan11/lib/python2.7/site-packages']
Server time: Wed, 6 Jan 2016 13:36:30 +0000
Looks like the issue is in view: metadata_add(request, document_id=None, document_id_list=None)
while preparing the redirect to metadata_multiple_edit:
return HttpResponseRedirect('%s?%s' % (
reverse('metadata:metadata_multiple_edit'),
urlencode({'id_list': document_id_list, 'next': next}))
document_id_list is a list and rendered like that: '[2, 3]' into the url.
Possible fix: change line
urlencode({'id_list': document_id_list, 'next': next}))
to:
urlencode({'id_list': ', '.join(map(str, document_id_list)), 'next': next}))
br Matthias