31👍
✅
Try:
class BookForm(ModelForm):
class Meta:
model = Book
widgets = {
'details': Textarea(attrs={'cols': 40, 'rows': 4}),
}
InlineFormSet = inlineformset_factory(Author, Book, form=BookForm)
Update by Wtower
This is great. Specifically for widgets, as of Django 1.6 there is a widgets parameter for inlineformset_factory
Sounds like you can now call
inlineformset_factory(Author, Book, widgets={'details': Textarea(attrs={'cols': 40}))
0👍
I dont know if i have understand your question: do you want Book.details rendered as a textarea?
If so, just use a TextField instead a CharField.
class Author(models.Model):
description = models.TextField()
- Django-allauth: how to properly use email_confirmed signal to set user to active
- About index and primary key in SQL?
- Why does python new york time zone display 4:56 instead 4:00?
- Python/Django: sending emails in the background
Source:stackexchange.com