从多个领域获得一定质量的对象

时间:2018-01-29 19:23:02

标签: python django orm many-to-many

说我有以下型号:

$values[] = $wpdb->prepare( "(%s, $f)", $quantity, $price );

假设有两个级别:开发人员和测试人员。应编写哪些代码而不是class Project(Model): name = CharField() users = ManyToManyField(), through="Membership") @property def developers(self): ??? class Membership(Model): user = ForeignKey(AUTH_USER_MODEL) project = ForeignKey(Group) level = IntegerField() class Meta: unique_together = ("user", "project") ,以便???返回与项目相关的所有用户的查询集作为开发人员?

0 个答案:

没有答案