当前位置:首页>开发>正文

django里的post_set是什么用法

2023-04-18 16:34:39 互联网 未知 开发

 django里的post_set是什么用法

django里的post_set是什么用法?

应该是有个叫post的model存在一个到ModelA的外键,自动为ModelA反向生成一个字段

Following relationships “backward”
If a model has a ForeignKey, instances of the foreign-key model will have access to a Manager that returns all instances of the first model. By default, this Manager is named FOO_set, where FOO is the source model name, lowercased. This Manager returns QuerySets, which can be filtered and manipulated as described in the “Retrieving objects” section above.