On Sunday, July 15, 2012 6:16:42 PM UTC-3, Nicolas Emiliani wrote:
>
> Crap, hit the send key, there it goes. Sorry.
>
>
> Hi!
>>
>> I'm trying to override the AdminFileWidget with no success. The idea is
>> to get a thumbnail
>> next to the uploaded files in a tabular view of the admin site. I did the
>> following :
>>
>>
Just in case somebody reads this : I fxed it, it was working, but an
exception inside the
render method made the output look like the parent widget :S
> class AdminImageWidget(AdminFileWidget):
>> def render(self, name, value, attrs=None):
>>
>>
> Override the widget class for the image field
>
> class ImageGalleryForm(forms.ModelForm):
> '''
> Image Admin form
> '''
> class Meta:
> model = HomeImage
> fields =('image','description','name','height','width',)
> widgets = {
> 'image' : AdminImageWidget,
> }
>
>
> Here I set the Form
>
> class ImageGaleryInline(admin.TabularInline):
> form = ImageGalleryForm
> model = HomeImage
> extra = 3
>
> fieldsets = [
> (None, {
> 'fields' : [
> ('image','description','name','height','width'),
> ]
> }
> ),
> ]
>
>
> But the widget still shows itself as the AdminFileWidget, Am I missing
> something ?
>
> Thanks
>
>
>
>>
>> --
>> Nicolas Emiliani
>>
>> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>>
>
>
>
> --
> Nicolas Emiliani
>
> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/yRdMHbeK95wJ.
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.