From 8fa5ac7024f21f7e57b8ce0a26152e578e6128b6 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 3 Jan 2019 13:32:47 +0100 Subject: [PATCH] show required extensions --- stage2/forms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stage2/forms.py b/stage2/forms.py index 7a68314..09beefe 100644 --- a/stage2/forms.py +++ b/stage2/forms.py @@ -24,7 +24,10 @@ class AttachmentForm(forms.ModelForm): max_mb = options.get('max', 20) self.max_upload_size = max_mb * 1024 * 1024 self.fields['file'].widget.attrs['data-max'] = max_mb - self.fields['file'].label = label + u' (maks. %s MB)' % max_mb + label_extra = ['maks. %s MB' % max_mb] + if extensions: + label_extra.append('format: %s' % ', '.join(extensions)) + self.fields['file'].label = label + u' (%s)' % '; '.join(label_extra) if extensions: self.fields['file'].widget.attrs['data-ext'] = '|'.join(extensions) self.extensions = extensions -- 2.20.1