Django Country->State->City Dropdown list

3,514 views
Skip to first unread message

d

unread,
Nov 2, 2010, 1:31:18 PM11/2/10
to Django users
URGENT!
The following is my django code. I would like to have 3 column drop-
down list.

a member can select his location.
when a country is selected, then all states for that country will
display. the same thing happens to city.

Now, I know it has something to do with Javascript. The question is
there is no good tutorial for that

Please help me. It is super urgent

If you want to show links or code, it must come with a real working
demo. I have gone thought all links found on google.


Please direct me to the right direction. a simple step by step
instruction is very helpful

thanks
------------------------------------------------------------
from django.db import models


class Member(models.Model):

residing_country = models.CharField(max_length=50)
residing_state = models.CharField(max_length=50)
residing_city = models.CharField(max_length=50)

class Country(models.Model):

country= models.CharField(max_length=20)

class State(models.Model):

state=models.CharField(max_length=20)
country = models.ForeignKey(Country)

class City(models.Model):

city=models.CharField(max_length=20)
state=models.ForeignKey(State)

John Matthew

unread,
Nov 2, 2010, 1:45:37 PM11/2/10
to Django users
Sounds like AJAX is your answer, there are lots of AJAX libraries out
there that have examples on this.

J

Jirka Vejrazka

unread,
Nov 2, 2010, 2:00:34 PM11/2/10
to django...@googlegroups.com
> The following is my django code. I would like to have 3 column drop-
> down list.


It sounds like you might want to check out Dajax
(http://www.dajaxproject.com/), Dojango
(http://code.google.com/p/dojango/) or JQuery (there are plenty of
examples for using JQuery with Django out there).

Cheers

Jirka

P.S. Starting your email with "URGENT" it likely to give you less
responses, not more

d

unread,
Nov 2, 2010, 2:13:59 PM11/2/10
to Django users
Thanks. I can't find intuitive examples. Can anyone post a little
simple code

Shawn Milochik

unread,
Nov 2, 2010, 3:43:00 PM11/2/10
to django...@googlegroups.com
On Tue, Nov 2, 2010 at 2:13 PM, d <ryan.z....@gmail.com> wrote:
> Thanks. I can't find intuitive examples. Can anyone post a little
> simple code
>

<script type="text/javascript">

alert('Look it up on Google.');

</script>

Reply all
Reply to author
Forward
0 new messages