Instead of overriding widgets in the Meta class, simply set the widget to override __init__and specify the form in your admin class. The specified form will be used only for add / change views. Example:
from django import forms
class PedidoAdminForm(forms.ModelForm):
class Meta:
model = Pedido
def __init__(self, *args, **kwargs):
super(PedidoAdminForm, self).__init__(*args, **kwargs)
self.fields['nota'].widget = forms.Textarea()
from django.contrib import admin
from your_app.forms import PedidoAdminForm
from your_app.models import Pedido
class PedidoAdmin(admin.ModelAdmin):
form = PedidoAdminForm
list_editable = ['nota']
This works for me in Django 1.3. Hope this helps you.
source
share