0

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

mytuple = [('id', 'name','author')]
mybooks = Book.objects.values_list(mytuple)

error is

'list' object has no attribute 'split'
tej.tan
  • 3,715
  • 6
  • 26
  • 29

1 Answers1

9

You should use:

mytuple = ('id', 'name', 'author')
mybooks = Book.objects.values_list(*mytuple)
David Wolever
  • 139,281
  • 83
  • 327
  • 490