Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4016790
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:46:59+00:00 2026-05-20T09:46:59+00:00

I am using inline formsets. My model: class Author(models.Model): description = models.CharField(max_length=100) class Book(models.Model):

  • 0

I am using inline formsets.

My model:

class Author(models.Model):
    description = models.CharField(max_length=100)

class Book(models.Model):
    author = models.ForeignKey(Author)
    details = models.CharField(max_length=100)

class AuthorForm(ModelForm):
    class Meta:
        widgets = {
            'description': Textarea(attrs={'cols': 40, 'rows': 4}),
        }

In my views.py I made the form from the AuthorForm like so

form = AuthorForm(request.POST)

But I also made a formset for the Books

InlineFormSet = inlineformset_factory(Author, Books)

I cannot pass in a BooksForm with widgets, so how do I add a textarea widget to the book details.

Is it even possible? Am I missing something obvious?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:47:00+00:00Added an answer on May 20, 2026 at 9:47 am

    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
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am hiding an element using inline css, like so: <span class=hidden-nojs style=display:none>Some text</span>
I'm attempting to create a formset for the following models: class Category(models.Model): name =
I'm using Django and have a form with two additional inline formsets. I want
I have the following models: class Bill(models.Model): date = models.DateTimeField(_(Date of bill),null=True,blank=True) class Item(models.Model):
When using inline assembly with XLC compiler (for powerpc) the labels are translated and
So I am currently using inline-block for my site. I understand it's still relatively
What is the advantages/disadvantages of using inline functions in C++? I see that it
I'm using a 3-tier architecture for my application. I'm using inline code to call
I'm using an inline function to submit a form but it's not calling the
Using HTML and CSS. I have text surrounded by a border using display:inline to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.