Skip to content

Commit 0c30b35

Browse files
committed
Inject whole template into form object
1 parent 7d61c04 commit 0c30b35

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/main/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,8 +3212,8 @@ def validate_report_has_been_processed(self, field):
32123212

32133213

32143214
class TemplateEmailFilesUploadForm(StripWhitespaceForm):
3215-
def __init__(self, *args, existing_files, **kwargs):
3216-
self.existing_file_names = InsensitiveSet(file.filename for file in existing_files)
3215+
def __init__(self, *args, template, **kwargs):
3216+
self.existing_file_names = InsensitiveSet(file.filename for file in template.existing_files)
32173217
super().__init__(*args, **kwargs)
32183218

32193219
allowed_file_formats = {

app/main/views/template_email_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def upload_template_email_files(template_id, service_id):
146146
)
147147
if not current_service.contact_link:
148148
abort(403)
149-
form = TemplateEmailFilesUploadForm(existing_files=template.email_files)
149+
form = TemplateEmailFilesUploadForm(template=template)
150150
if form.validate_on_submit():
151151
template_email_file_id = TemplateEmailFile.create(
152152
filename=form.file.data.filename,

0 commit comments

Comments
 (0)