summaryrefslogtreecommitdiff
path: root/ishtar_common/forms_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-01-16 20:09:34 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-01-16 20:09:34 +0100
commit701e27958d98542b24e4e0bbd3f9604650bd0f8c (patch)
tree75b2bf05b5896ce960165a28b9b23b4f18a593c0 /ishtar_common/forms_common.py
parentf250dc4ee10f722876c09246c8acc3f5ff213ee4 (diff)
downloadIshtar-701e27958d98542b24e4e0bbd3f9604650bd0f8c.tar.bz2
Ishtar-701e27958d98542b24e4e0bbd3f9604650bd0f8c.zip
Indication of the maximum file size in help for file fields
Diffstat (limited to 'ishtar_common/forms_common.py')
-rw-r--r--ishtar_common/forms_common.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index b461d6266..47a282ab7 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -44,7 +44,8 @@ from ishtar_common.templatetags.link_to_window import simple_link_to_window
from forms import FinalForm, FormSet, reverse_lazy, name_validator, \
TableSelect, ManageOldType, CustomForm, FieldType, FormHeader, \
FormSetWithDeleteSwitches, IshtarForm, get_data_from_formset
-from ishtar_common.utils import is_downloadable, clean_session_cache
+from ishtar_common.utils import is_downloadable, clean_session_cache, \
+ max_size_help
from archaeological_operations.models import Operation
from archaeological_context_records.models import ContextRecord
@@ -1072,11 +1073,13 @@ class MergeOrganizationForm(MergeForm):
def get_image_help():
if not settings.IMAGE_MAX_SIZE:
- return ""
- return _(u"<p>Heavy images are resized to: %(width)dx%(height)d "
- u"(ratio is preserved).</p>") \
+ return max_size_help()
+ return unicode(
+ _(u"Heavy images are resized to: %(width)dx%(height)d "
+ u"(ratio is preserved).") \
% {'width': settings.IMAGE_MAX_SIZE[0],
- 'height': settings.IMAGE_MAX_SIZE[1]}
+ 'height': settings.IMAGE_MAX_SIZE[1]}) + " " + unicode(
+ max_size_help())
#######################
@@ -1108,7 +1111,7 @@ class DocumentForm(forms.ModelForm, CustomForm, ManageOldType):
max_length=255, required=False, widget=widgets.ImageFileInput())
associated_file = forms.FileField(
label=pgettext(u"Not directory", u"File"), max_length=255,
- required=False)
+ required=False, help_text=max_size_help())
reference = forms.CharField(
label=_(u"Reference"),
validators=[validators.MaxLengthValidator(100)], required=False)