From 69bd6c116e209f146cf04342de286feec9eb60ee Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sun, 7 Apr 2019 22:45:06 -0400 Subject: [PATCH] Improve multiple tag wizard step code Previous code produce an error when there were not tag IDs passed to the wizard. Signed-off-by: Roberto Rosario --- mayan/apps/tags/wizard_steps.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mayan/apps/tags/wizard_steps.py b/mayan/apps/tags/wizard_steps.py index a9bf47da30..d0f8be1072 100644 --- a/mayan/apps/tags/wizard_steps.py +++ b/mayan/apps/tags/wizard_steps.py @@ -45,7 +45,12 @@ 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['tags'].split(',')): + tag_id_list = furl_instance.args.get('tags', '') + + if tag_id_list: + tag_id_list = tag_id_list.split(',') + + for tag in Tag.objects.filter(pk__in=tag_id_list): tag.documents.add(document)