Hi evebody! :)
How I may change widget in inlineformset_factory ?
I have field (Image with thumbnail - this is Satchmo code), and have
custom widget.
class ImageWithThumbnailWidget(forms.FileInput):
"""
A FileField Widget that shows its current image as a thumbnail if
it has one.
"""
def __init__(self, attrs={}):
super(ImageWithThumbnailWidget, self).__init__(attrs)
def render(self, name, value, attrs=None):
output = []
if value and hasattr(value, "url"):
thumb = make_admin_thumbnail(value.url)
if not thumb:
thumb = value.url
output.append('<img src="%s" /><br/>%s<br/> %s ' % \
(thumb, value.url, _('Change:')))
output.append(super(ImageWithThumbnailWidget,
self).render(name, value, attrs))
return mark_safe(u''.join(output))
But if i write
class ImageWithThumbnailField(ImageField):
widget = ImageWithThumbnailWidget
inlineformset_factory don't have thumbnail of image- i see only
standart file input field.
Is there render method don't work with inlineformset ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---