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 953277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:01:43+00:00 2026-05-16T00:01:43+00:00

Thanks to the fantastic inline model formsets in django I have a pretty advanced

  • 0

Thanks to the fantastic inline model formsets in django I have a pretty advanced form with 4 inline formsets. In the template I display each formset in a tab. Everything works really slick but I would like to color a tab red if the formset in that tab has any validation errors at all. So I tried this:

<div id="tabs">
    <ul>
        <li><a href="#foo-tab"{% if forms.FooFormSet.errors %} class="error"{% endif %}>Foo</a></li>
        <li><a href="#bar-tab"{% if forms.BarFormSet.errors %} class="error"{% endif %}>Bar</a></li>
        <li><a href="#zoo-tab"{% if forms.ZooFormSet.errors %} class="error"{% endif %}>Zoo</a></li>
        <li><a href="#doo-tab"{% if forms.DooFormSet.errors %} class="error"{% endif %}>Doo</a></li>
    </ul>

    <div id="foo-tab"></div>
    <div id="bar-tab"></div>
    <div id="zoo-tab"></div>
    <div id="doo-tab"></div>
</div>

But it doesnt work because forms.*Set.errors is a list with empty dictionarys (so it will always return True) like [{}, {}, {}] (the amount of forms in the formsets is the same amount of empty dictionarys in formset.errors

One solution I think could be to subclass BaseInlineFormSet and add a has_errors method or something, and then use that subclassed base for all my formsets. Any other suggestions? Thanks!

  • 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-16T00:01:44+00:00Added an answer on May 16, 2026 at 12:01 am

    You can check the result of the formset’s method is_valid, which in turn checks each form for validity: {% if forms.FooFormSet.is_valid %}.

    As far as I know, it is more or less a no-op (database is not touched, forms are not revalidated) if the forms have already undergone validation, so it is not going to hurt the performance at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks for reading this. I have no idea why this is throwing a NullReferenceException
Thanks in advance for your help. I have a need within an application to
Thanks for reading. I have done a search, read multiple posts (lost count) and
I'd like to mimick (reproduce) Expression Engine's fantastic template parsing method. (Pls don't ask
I have a requirement to have a small form with some text boxes on
I received fantastic help from Dave Costa and Justin Cave here (thanks again) in
Thanks for the answers, I have not used StackOverflow before so I was suprised
Thanks to a fantastic video on youtube which you can access here if you
I came across this tutorial: http://thomas.broxrost.com/2008/04/08/django-on-google-app-engine/ Fantastic! Everything worked. I just did not fully
Thanks to Jeffrey for the fantastic one, http://msdn.microsoft.com/en-us/magazine/bb985010.aspx The garbage collector scans the finalization

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.