當前位置:成語大全網 - 新華字典 - 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.