In Django QuertSet, which method is used to get each object as a Python dictionary, with the names and values as key/value pairs?

30. In Django QuertSet, which method is used to get each object as a Python dictionary, with the names and values as key/value pairs?

  1. values()
  2. dictionary()
  3. getvalues()
  4. None of the above

Answer: A) values()

Explanation:

In Django QuertSet, the values() method is used to get each object as a Python dictionary, with the names and values as key/value pairs. Consider the below code statement –

dataObj = students.objects.all().values()

Where, "students" is model name.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.