From 12f422fd95e3b5d6228f220c67ae2a203898007c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 16 Jan 2019 20:09:34 +0100 Subject: Indication of the maximum file size in help for file fields --- ishtar_common/models_imports.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'ishtar_common/models_imports.py') diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py index b5ce3323d..e9f0e5d9e 100644 --- a/ishtar_common/models_imports.py +++ b/ishtar_common/models_imports.py @@ -41,7 +41,7 @@ from django.utils.translation import ugettext_lazy as _, pgettext_lazy from ishtar_common.utils import create_slug, \ get_all_related_m2m_objects_with_model, put_session_message, \ - put_session_var, get_session_var, num2col + put_session_var, get_session_var, num2col, max_size_help from ishtar_common.data_importer import Importer, ImportFormater, \ IntegerFormater, FloatFormater, UnicodeFormater, DateFormater, \ TypeFormater, YearFormater, StrToBoolean, FileFormater, InseeFormater, \ @@ -828,10 +828,11 @@ class Import(models.Model): name = models.CharField(_(u"Name"), max_length=500, null=True) importer_type = models.ForeignKey(ImporterType) imported_file = models.FileField( - _(u"Imported file"), upload_to="upload/imports/%Y/%m/", max_length=220) + _(u"Imported file"), upload_to="upload/imports/%Y/%m/", max_length=220, + help_text=max_size_help()) imported_images = models.FileField( _(u"Associated images (zip file)"), upload_to="upload/imports/%Y/%m/", - blank=True, null=True, max_length=220) + blank=True, null=True, max_length=220, help_text=max_size_help()) associated_group = models.ForeignKey( TargetKeyGroup, blank=True, null=True, help_text=_(u"If a group is selected, target key saved in this group " @@ -842,15 +843,15 @@ class Import(models.Model): skip_lines = models.IntegerField( _(u"Skip lines"), default=1, help_text=_(u"Number of header lines in your file (can be 0).")) - error_file = models.FileField(_(u"Error file"), - upload_to="upload/imports/%Y/%m/", - blank=True, null=True, max_length=255) - result_file = models.FileField(_(u"Result file"), - upload_to="upload/imports/%Y/%m/", - blank=True, null=True, max_length=255) - match_file = models.FileField(_(u"Match file"), - upload_to="upload/imports/%Y/%m/", - blank=True, null=True, max_length=255) + error_file = models.FileField( + _(u"Error file"), upload_to="upload/imports/%Y/%m/", + blank=True, null=True, max_length=255, help_text=max_size_help()) + result_file = models.FileField( + _(u"Result file"), upload_to="upload/imports/%Y/%m/", + blank=True, null=True, max_length=255, help_text=max_size_help()) + match_file = models.FileField( + _(u"Match file"), upload_to="upload/imports/%Y/%m/", blank=True, + null=True, max_length=255, help_text=max_size_help()) state = models.CharField(_(u"State"), max_length=2, choices=IMPORT_STATE, default=u'C') conservative_import = models.BooleanField( -- cgit v1.2.3