diff options
| author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-09-04 20:05:24 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-09-04 20:05:24 +0200 | 
| commit | 1f16014274a2ad16fcd635fc9b506ef429a33677 (patch) | |
| tree | d7e4c7b4121f09210b398aa4d6bc3830e6e1858e /ishtar_common/widgets.py | |
| parent | 4aa9cda8b8bd1c9f51e467541a97d30669130243 (diff) | |
| download | Ishtar-1f16014274a2ad16fcd635fc9b506ef429a33677.tar.bz2 Ishtar-1f16014274a2ad16fcd635fc9b506ef429a33677.zip | |
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
Diffstat (limited to 'ishtar_common/widgets.py')
| -rw-r--r-- | ishtar_common/widgets.py | 5 | 
1 files changed, 5 insertions, 0 deletions
| 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('</td></tr>')
          return mark_safe('\n'.join(output))
 +class ImageFileInput(ClearableFileInput):
 +    template_with_initial = u'<span class="prettyPhoto">%(initial)s</span>'\
 +                      u' %(clear_template)s<br />%(input_text)s: %(input)s'
 +
  class SquareMeterWidget(forms.TextInput):
      def render(self, name, value, attrs=None):
          if not value:
 | 
