diff --git a/app/main/forms.py b/app/main/forms.py index d46815e8d..a45644245 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1212,6 +1212,9 @@ class TemplateAndFoldersSelectionForm(Form): ('copy-existing', 'Copy of an existing template') if allow_adding_copy_of_template else None, ])) + def is_selected(self, template_folder_id): + return template_folder_id in (self.templates_and_folders.data or []) + def validate(self): self.op = request.form.get('operation') diff --git a/app/templates/views/templates/_template_list.html b/app/templates/views/templates/_template_list.html index f26e32b0d..e4c030e76 100644 --- a/app/templates/views/templates/_template_list.html +++ b/app/templates/views/templates/_template_list.html @@ -17,6 +17,7 @@ {{ unlabelled_checkbox( id='templates-or-folder-{}'.format(item.id), name='templates_and_folders', + data=templates_and_folders_form.is_selected(item.id), value=item.id, ) }} {% endif %}