Home »
Python »
Django MCQs
In Django QuertSet, which method is used to get all the records and fields of a given model?
29. In Django QuertSet, which method is used to get all the records and fields of a given model?
- get()
- all()
- getall()
- bunch()
Answer: B) all()
Explanation:
In Django QuertSet, the all() method is used to get all the records and fields of a given model. Consider the below code statement in which we are getting all records –
dataObj = students.objects.all()
Where, "students" is model name.