On Tue, 2011-08-16 at 05:46 +0000, Asif Jamadar wrote:
> I have two dropdowns one dropdown is dependent on other (Ex.
> Country/State dropdowns)
> 
> Now how can I implement this thing in django?
> 
> I'm using modelform concept to display form which having two dropdowns
> 
> Any sugtgestions? 

without ajax:

1. override __init__ on your modelform, pass the value of the first
dropdown to __init__ and populate the second dropdown depending on that
value. If the value is None, the second dropdown will not be populated.

2. in your template, refresh the page when the value of the first
dropdown changes.

A sample of overriding __init__ is here:
https://bitbucket.org/lawgon/djangogolf/src/822bb414b722/web/views.py#cl-379
-- 
regards
Kenneth Gonsalves

_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to