I have my own TagField form field.
class TagField(forms.CharField): def __init__(self, *args, **kwargs): super(TagField, self).__init__(*args, **kwargs) self.widget = forms.TextInput(attrs={'class':'tag_field'})
As you can see above, it uses the TextInput form field widget. But in admin, I would like it to be displayed using the Textarea widget. There is a formfield_overrides hook for formfield_overrides , but it does not work for this case.
Ad Ad:
class ProductAdmin(admin.ModelAdmin): ... formfield_overrides = { TagField: {'widget': admin.widgets.AdminTextareaWidget}, }
This does not affect the form field widget, and tags is still displayed using the TextInput widget.
Any help is greatly appreciated.
- OMAT Page
override django django-admin widget
omat Aug 12 '10 at 16:43 2010-08-12 16:43
source share