【发布时间】:2013-09-28 19:13:38
【问题描述】:
如何建模以下关系:
class Country(models.Model):
# The capital city of this country
capital = models.ForeignKey(City)
## other country stuff
class City(models.Model):
# The country where this city lies in
country = models.ForeignKey(Country)
## other city stuff
这显然不能编译。 (城市在国家的定义中未定义)。 有什么建议吗?
【问题讨论】:
标签: django django-models