On Tuesday 26 January 2010 18:26:55 shofty wrote: > I'm trying to build an app which im calling selector. It allows a user > to select from a form of dropdowns their vehicle. > > the problem im facing is a design one. i just dont know how best to > design this and i've spent ages trying to find an example that does > the same thing. but i can't find one. > > so a vehicle is thus: > make > - model > - - year > - - - trim > > and my idea for the view was a simple one of four dropdowns, whose > content changed as you amended the others. so you'd choose make and > model would appear populated with all models for the make selected. > and so on. > > I've come to the understanding that there is no built in way to do > this in django/python projects due to its static nature and that im > going to involve an amount of javascript. > > what i'd really hoped to do, was find a way that i can create in the > view various querys for the dropdowns and on selection of one of the > dropdowns, tie the selection to the query, returning a dictionary to > the next dropdown, populating it with relevant data. > > if i resort to use of js (of which there is plenty of examples) i'm > going to struggle to tie it back to my database. aren't i? > > im not asking someone to code this for me, design clues and links to > examples much appreciated. You will either use JavaScript to populate SELECTs for remaining options or reload the page onChange via JavaScript. So your options are limited; it's JavaScript or JavaScript.
I would supply AJAX views that return requested options as JSON. The rest is client-side coding (IOW not Django related). Plenty of AJAX with Django examples out there on intertubes. -- Saygılarımla, Atamert Ölçgen -+- --+ +++ www.muhuk.com mu...@jabber.org -- 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 at http://groups.google.com/group/django-users?hl=en.