Group by limit 1 in django

前端 未结 3 1797
名媛妹妹
名媛妹妹 2021-01-27 10:54

I have the following models in Django (simplified for brevity):

class DistinctWord(models.Model):
    ...

class Word(models.Model):
    distinct_word = models.F         


        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-27 11:35

    How about (given your queryset of uw): [obj.words.first() for obj in uw]

提交回复
热议问题