26.8.2012 21:54, Joseph Mutumi kirjoitti:
> Hello,
>
> If A is a model with ForeignKey relationships to B. What would be the
> best way of rendering two
> selectboxes, A and B. The values of B are the values filtered through
> using the relationship with
> the selected value of A via an AJAX call.
>
> I need to get these values from the DB as well as have Django validation
> work out? All ideas are
> welcome!
Well it works exactly as you described. You hookup with your JS
framework to change event of selectbox A to run query and update
contents (by calling django view with correct params) of selectbox B.
I suggest that you keep validation to happen on form submit rather than
when updating two field values.
Just find out what is the best way to do that with your JS framework.
Try googling "dependent selectboxes <name of your js framework" and it
should get you going. By adding keyword Django might give even more help.
--
Jani Tiainen
- Well planned is half done and a half done has been sufficient before...
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment