pre-check templates/folders that were checked previously

(when rendering an error)
This commit is contained in:
Leo Hemsted
2018-11-30 16:31:42 +00:00
parent bb50326811
commit 05de491c0c
2 changed files with 4 additions and 0 deletions

View File

@@ -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')

View File

@@ -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 %}