Django: raw SQL and values_list() bug?
Doing something lik开发者_StackOverflow中文版e
SomeModel.objects.extra(..).values_list('id', flat=True)
always returns an empty list
Is this a Django bug ? Or am I missing seomthing?
From the documentation:
If you use a
values()
clause after anextra()
clause, any fields defined by aselect
argument in theextra()
must be explicitly included in thevalues()
clause. However, if theextra()
clause is used after thevalues()
, the fields added by theselect
will be included automatically.
精彩评论