From 057f6d81d5dee5ba8eba2fd959553cf57657990d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 4 Sep 2013 20:05:24 +0200 Subject: Improve Image field management (refs #1365) * add a custom widget to allow display via prettyPhoto on forms * disable resizing when the image is deleted * fix "has image" search request to manage empty and null field for images * fix deletion of files by the wizard * fix initialization of instancied form for files and images --- ishtar_common/widgets.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ishtar_common/widgets.py') diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 94d7f709a..a97cfe70b 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -23,6 +23,7 @@ from django import forms from django.conf import settings from django.core.urlresolvers import resolve, reverse from django.db.models import fields +from django.forms import ClearableFileInput from django.forms.widgets import flatatt from django.template import Context, loader from django.utils.encoding import smart_unicode @@ -42,6 +43,10 @@ class DeleteWidget(forms.CheckboxInput): output.append('') return mark_safe('\n'.join(output)) +class ImageFileInput(ClearableFileInput): + template_with_initial = u'%(initial)s'\ + u' %(clear_template)s
%(input_text)s: %(input)s' + class SquareMeterWidget(forms.TextInput): def render(self, name, value, attrs=None): if not value: -- cgit v1.2.3