我想将元组传递给此函数,但我收到错误
mytuple = [('id', 'name','author')]
mybooks = Book.objects.values_list(mytuple)
错误是
'list' object has no attribute 'split'
答案 0 :(得分:7)
您应该使用:
mytuple = ('id', 'name', 'author')
mybooks = Book.objects.values_list(*mytuple)