Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Override data validation on one django form element [RSS Feed]

#1 Dec. 3, 2010 00:55:00

E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Override data validation on one django form element


I have a select list dropdown box on my form that is populated with
data from a Model (Directors). The value of this dropdown doesn't need
to be saved; it is really only used to dynamically trigger another
element of the form (a dropdown titled Films). So when the user
chooses a Director, it dynamically populates the second list with the
Films attached to that Director.

The first element of the first list is "All Directors." Instead of
filtering the Film List, it lets all Films be shown on the second list
because All Directors is chosen.

If the user chooses a specific Director and then a Film, the form
submits correctly. The problem is that if the user chooses All
Directors, and then selects a Film, when the form is submitted, it
tells me that my choice for Directors is not valid because it is not
one of the available choices. In this instance, an available choice (I
assume) is one of the existing Director.objects that is in the
database. But because I don't care about the Director, I don't need
this entry to be valid. I just need Film to be valid.

I'm using a ModelForm. How can I disable or override the data
validation on the Director form field so that it ignores the error
that that field generates?

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Override data validation on one django form element [RSS Feed]

Board footer

Moderator control

Enjoy the 24th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support