这是一个创建于 3624 天前的主题,其中的信息可能已经有所发展或是发生改变。
比如说现在想增加一个评论,评论是存在另外一个表里,在展示Product的详情页的时候,想把这个商品的评论都展示出来,我想最好的办法就是给Product增加方法,或者是扩展action?
2 条回复 • 2015-04-11 18:48:41 +08:00
 |
|
1
cc21 2015-04-11 09:10:56 +08:00
|
 |
|
2
wph95 2015-04-11 18:48:41 +08:00
评论(comment)模型(model)加个ForeignKey 连到Product comment = models.ForeignKey("Product")
然后 product.comment_set.all()就是所有的评论queryset
|