我正试图在django中查询 我的模型在下面
class Game(models.Model):
name = models.CharField(max_length=100)
created_at = models.DateTimeField(auto_now_add=True)
我的情况:
Game(name='League of Legend')
Game(name='StartCraft')
Game(name='OverWatch')
word_list = ["league", "over", "craft", "legend"]
games = Game.objects.annotate(word_count=blablabla).order_by('-word_count')
所需的结果查询集:
Gmae('League of Legend', 2)
Game('StartCraft', 1)
Game('OverWatch', 1)
有解决方案吗? :)