开发者

Django - replacing string in Model.objects.extra for variable

For example, if I have list of ids values like this:

values = list(set(Handler.objects.filter(blog=1).values_list('entry_id', f开发者_运维技巧lat=True)))

and i want to give variable "values" instead of numbers in string format to extra method like this:

Entry.objects.extra(where=['id IN (3, 4, 5, 20)'])

It is possible somehow to replace numbers for "values"?


... Huh?

Entry.objects.filter(id__in=values)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜