我有以下对象:
class Customer(models.Model):
name = models.CharField(max_length=128)
class Group(models.Model):
customer = models.ForeignKey(Customer)
class GroupMember(models.Model):
group = models.ForeignKey(Group)
member = models.ForeignKey(Member)
class Member(models.Model):
customer = models.ForeignKey(Customer)
我可以通过以下方式将所有成员分配给一个组:
group_members = group.groupmember_set.all()
可用于特定客户的所有成员:
member_list = customer.members.all()
我想创建一个未分配到组的客户可用的所有成员的列表。就像是:
not_group_members = Member.objects.filter(?)
如何创建此查询?