I have 3 simple models:
class Province(models.Model):
name = models.CharField(max_length=30)
slug = models.SlugField(max_length=30, unique=True)
class UserProvince(models.Model):
user = models.ForeignKey(User)
province = models.ForeignKey(Province)
class UserCity(models.Model):
user = models.ForeignKey(User)
province = models.ForeignKey(Province)
city = models.CharField(max_length=10)
slug = models.SlugField(max_length=100, editable=False)
now, each user can have several provinces added. then, he can add several cities to his each added province.
province1
city1
city2
city3
province2
city4
city5
city6
province3
city7
city8
city9
I want to display all his provinces and under each of it, I want to display form with input to add city to it. What is the best way to do this? There's going to be unknown number of provinces.
-- 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment