Which of the following is NOT true about Django's get_or_create method?
Correct answer
D. It can only be used with integer fields
19 views
D. It can only be used with integer fields
19 views
The false statement is that get_or_create() can only be used with integer fields — it accepts lookups on any field type.
The other statements are true: it fetches the object or creates it, returns an (object, created) tuple, and raises MultipleObjectsReturned if several rows match.
Practise more Computer Science MCQs with answers and explanations on MCQsExam.com.
Not sure why the answer is D? Ask here and get an explanation.