开发者

How to pass tuple as argument to django function

I want to pass tuple to this function but i am getting error

mytuple = [('id', 'name','author')]
myboo开发者_运维知识库ks = Book.objects.values_list(mytuple)

error is

'list' object has no attribute 'split'


You should use:

mytuple = ('id', 'name', 'author')
mybooks = Book.objects.values_list(*mytuple)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜