我有一个查询集:
Organisation.objects.values_list('first_parent', flat=True).distinct()
它给我的结果是[1,2],我需要组织名称,但当我需要时:
^{pr2}$它给了我这些组织的名字。这里怎么了?在
我的组织模式:
class Organisation(User):
organisation_name = models.CharField(max_length=200)
first_parent = models.ForeignKey('Parent', related_name="first", blank=True, null=True)
def __unicode__(self):
return self.username
^{} 使用SQLWHERE子句获取外部表父级
是的。在
相关问题 更多 >
编程相关推荐