If you use django admin to manage your application and use a CharField
with size more than 300 i’m sure you need a Text Area to fill it in, yes in your admin too.
It’s just a few additional lines to your forms.py
(define a new form with widget) and admin.py
( Inform model admin to use the form).
# forms.py
class FaqForm(forms.ModelForm):
answer = forms.CharField( widget=forms.Textarea(attrs={'rows': 5, 'cols': 100}))
class Meta:
model = Faq
fields = ('__all__')
That my custom form with Textarea
widget attached to answers field which is a CharFIeld
.
#admin.py
class FaqsAdmin(admin.ModelAdmin):
list_display = ['id', 'question', 'status']
form = FaqForm
You got yourself a text area in your admin.