擅长:python、mysql、java
<p>我不是百分之百肯定,但你能试试吗</p>
<pre><code>[people.objects.get(pk=x[0]) for x in people.objects.all().values_list('supervisor', flat=True).distinct()]
</code></pre>
<p>或</p>
<pre><code>[people.objects.get(id=x[0]) for x in people.objects.all().values_list('supervisor', flat=True).distinct()]
</code></pre>
<p>在你提到的链接中,我相信
<code>DatedResource.objects.all().values_list('date', flat=True).distinct())</code>
返回字符串的数组</p>
<p>在代码中
<code>people.objects.all().values_list('supervisor', flat=True).distinct() </code>
将返回一个int字符串-记录的ID,因为它是外键</p>