class Movie(models.Model):
format = models.ForeignKey(MovieFormat)
region = models.ForeignKey(Region)
date = models.Datefield()
... other fields you want, like title for instance
class Movie(models.Model):
... fields that you want for a movie, like foreing key to a producer for instance
class MovieEdition(models.Model):
movie = models.ForeignKey(Movie)
format = models.ForeignKey(MovieFormat)
region = models.ForeignKey(Region)
date = models.Datefield()
... other fields, like movie title for that region (the related region)
我不完全明白你想做什么,但我认为你看得不对。你知道吗
根据我对什么是电影的想法(我试图在这里考虑面向对象),您应该使用以下内容:
使用这样的模型,您可以在数据库中存储具有不同格式(格式存储在其他表中,因此您可以对数据库进行规范化)、不同区域和每个电影的日期(区域与此处的格式相同)的电影(现在停止在对象中思考)。你知道吗
这就是你想要的吗?如果没有,你的问题要具体点。。。添加一个例子与一些电影和他们的关系与地区和格式。。。你知道吗
编辑:
现在我知道你想要什么了。我不知道我将要添加的车型的确切名称,但我相信您会找到一个合适的名称:
希望有帮助!干杯!你知道吗
相关问题 更多 >
编程相关推荐