开发者

How to pass tuple as argument to django function

开发者 https://www.devze.com 2023-03-18 05:59 出处:网络
I want to pass tuple to this function but i am getting error mytuple = [(\'id\', \'name\',\'author\')]

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

精彩评论

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