I am trying to implement a restaurant chief website.
So basically, I have States, Cities, Restaurants and Chiefs.
Class State(models.Model):
name = models.CharField(max_length=30)
Class City(models.Model):
name = models.CharField(max_length=30)
state = models.ForeignKey(State)
class Restaurant(models.Model):
name = models.CharField(max_length=30)
state = models.ForeignKey(City)
class Chief(models.Model):
name = models.CharField(max_length=30)
restaurant = models.ForeignKey(Restaurant)
Rules:
States and city relations are fixed. A city cannot move to another state. But new states and city may be added.
A restaurant can move to another city.
A chief can move to another restaurant.
A restaurant can have more than one chiefs.
1) Is this a correct model?
2) I upload some of the data via admin form, and some from fixtures, but sometimes when I need to change a Chief to another restaurant in a different state it causes problem when I try to view the website (manage.py loaddata fixture works fine) . But there is no problem with changing to a different restaurant within the same city.
I am open to any practical MySQL/Django book suggestions.