diff options
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 |
commit | 12f422fd95e3b5d6228f220c67ae2a203898007c (patch) | |
tree | 75b2bf05b5896ce960165a28b9b23b4f18a593c0 /ishtar_common/models.py | |
parent | 696671dea6b284eea36affd473d9f036de4db71f (diff) | |
download | Ishtar-12f422fd95e3b5d6228f220c67ae2a203898007c.tar.bz2 Ishtar-12f422fd95e3b5d6228f220c67ae2a203898007c.zip |
Indication of the maximum file size in help for file fields
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 71868cb63..73366e35a 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -27,7 +27,6 @@ from importlib import import_module from jinja2 import TemplateSyntaxError import logging import os -import pytz import re import shutil import tempfile @@ -56,7 +55,6 @@ from django.db.utils import DatabaseError from django.template.defaultfilters import slugify from django.utils.functional import lazy from django.utils.safestring import SafeUnicode, mark_safe -#from django.utils.timezone import now, timedelta from django.utils.translation import ugettext_lazy as _, ugettext, \ pgettext_lazy, activate, deactivate from secretary import Renderer as SecretaryRenderer @@ -73,7 +71,7 @@ from ishtar_common.models_imports import ImporterModel, ImporterType, \ Import, TargetKeyGroup from ishtar_common.utils import get_cache, disable_for_loaddata, create_slug, \ get_all_field_names, merge_tsvectors, cached_label_changed, \ - generate_relation_graph + generate_relation_graph, max_size_help __all__ = [ 'ImporterModel', 'ImporterType', 'ImporterDefault', 'ImporterDefaultValues', @@ -992,9 +990,10 @@ def get_image_path(instance, filename): class ImageModel(models.Model): image = models.ImageField(upload_to=get_image_path, blank=True, null=True, - max_length=255) - thumbnail = models.ImageField(upload_to=get_image_path, blank=True, - null=True, max_length=255) + max_length=255, help_text=max_size_help()) + thumbnail = models.ImageField( + upload_to=get_image_path, blank=True, null=True, max_length=255, + help_text=max_size_help()) IMAGE_MAX_SIZE = settings.IMAGE_MAX_SIZE THUMB_MAX_SIZE = settings.THUMB_MAX_SIZE IMAGE_PREFIX = '' @@ -1115,7 +1114,7 @@ class RelationItem(models.Model): """ relation_image = models.FileField( _(u"Generated relation image (SVG)"), null=True, blank=True, - upload_to=get_image_path + upload_to=get_image_path, help_text=max_size_help() ) class Meta: @@ -2538,7 +2537,7 @@ class DocumentTemplate(models.Model): slug = models.SlugField(_(u"Slug"), blank=True, null=True, max_length=100, unique=True) template = models.FileField( - _(u"Template"), upload_to="templates/%Y/") + _(u"Template"), upload_to="templates/%Y/", help_text=max_size_help()) associated_object_name = models.CharField( _(u"Associated object"), max_length=100, choices=CLASSNAMES) available = models.BooleanField(_(u"Available"), default=True) @@ -3896,7 +3895,8 @@ class Document(OwnPerms, ImageModel, FullSearch, Imported): title = models.TextField(_(u"Title"), blank=True, default='') associated_file = models.FileField( - upload_to=get_image_path, blank=True, null=True, max_length=255) + upload_to=get_image_path, blank=True, null=True, max_length=255, + help_text=max_size_help()) index = models.IntegerField(verbose_name=_(u"Index"), blank=True, null=True) external_id = models.TextField(_(u"External ID"), null=True, blank=True) |