From c57df85ecc998ab2990ced127727f1f3637200e8 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Tue, 25 Sep 2018 11:37:27 +0100 Subject: [PATCH] Make the rendering of the two file uploads more consistent --- opentech/apply/stream_forms/files.py | 3 +++ .../templates/stream_forms/fields/multi_file_field.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/opentech/apply/stream_forms/files.py b/opentech/apply/stream_forms/files.py index e31b07cf7..5ec7c84f2 100644 --- a/opentech/apply/stream_forms/files.py +++ b/opentech/apply/stream_forms/files.py @@ -22,6 +22,9 @@ class StreamFieldFile(File): self.filename = filename or os.path.basename(self.name) self._committed = False + def __str__(self): + return self.filename + def __eq__(self, other): return self.filename == other.filename and self.size == other.size diff --git a/opentech/apply/stream_forms/templates/stream_forms/fields/multi_file_field.html b/opentech/apply/stream_forms/templates/stream_forms/fields/multi_file_field.html index de6bbcfaf..de66cb4cc 100644 --- a/opentech/apply/stream_forms/templates/stream_forms/fields/multi_file_field.html +++ b/opentech/apply/stream_forms/templates/stream_forms/fields/multi_file_field.html @@ -6,7 +6,7 @@ <p> <input type="checkbox" name="{{ widget.checkbox_name }}-{{ forloop.counter }}" id="{{ widget.checkbox_id }}-{{ forloop.counter }}"> <label for="{{ widget.checkbox_id }}-{{ forloop.counter }}"></label> -<a href="{{ file.url }}">{{ file.filename }}</a> +<a href="{{ file.url }}">{{ file }}</a> </p> {% endfor %} {{ widget.input_text }}{% endif %} -- GitLab