I'm building a website where the user must enter his location information 
during user registration.

I would like to have a combo box for each of the country, state, and city 
fields.
The user will drill down their selections by first selecting their country, 
then the state combo box should enable with only the states available for the 
selected country,
the user then selects his state/region/province and 
then the city combo should be enabled and populated with the cities available 
for the previously selected country/state combination.  Preferably this should 
happen without having to do a page refresh (maybe using AJAX?) between updates.

My models look like this:

class Country(models.Model):
    name = models.CharField(max_length=50)
    code= models.CharField(max_length=3)

class State(models.Model):
    name = models.CharField(max_length=30)
    country = models.ForeignKey(Country)

class City(models.Model):
    name = models.CharField(max_length=60)
    state = models.ForeignKey(State)

I know this might involve some ajax or js incantations, so if somebody could 
point me to some examples or a website that explains how to do this will be 
greatly appreciated.

I believe this must be a fairly common thing to do when developing some web 
applications but I have not been able to find the solution.

Thanks in advance! :)

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to