Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update person_form.html #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mkasapoglu
Copy link

if user do not select country, updates cities without send request to server. Otherwise server raises internal error.

if user do not select country, updates cities without send request to server.
@delhipnr
Copy link

delhipnr commented Jun 6, 2018

HI its actually awesome, need more help.

My form is like below:
Continent
Country
State
City

Can you please help me on that with form code?

class Continent(models.Model):
name = models.CharField(max_length=30)

def __str__(self):
    return self.name

class Country(models.Model):
name = models.CharField(max_length=30)
continent = models.ForeignKey(Continent, on_delete=models.CASCADE)

def __str__(self):
    return self.name

class State(models.Model):
name = models.CharField(max_length=40)
country = models.ForeignKey(Country, on_delete=models.CASCADE)

def __init__(self):
    return self.name

class City(models.Model):
country = models.ForeignKey(State, on_delete=models.CASCADE)
name = models.CharField(max_length=30)

def __str__(self):
    return self.name

class Person(models.Model):
name = models.CharField(max_length=100)
birthdate = models.DateField(null=True, blank=True)
country = models.ForeignKey(Country, on_delete=models.SET_NULL, null=True)
state = models.ForeignKey(State, on_delete=models.SET_NULL, null=True)
city = models.ForeignKey(City, on_delete=models.SET_NULL, null=True)

def __str__(self):
    return self.name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants