Django Output Prediction Hard +35 XP
get_or_create Return
What does get_or_create return?
DjangoRead-only
user, created = User.objects.get_or_create(email='alice@test.com')
What is the output?
Show answer and explanation
Answer: (instance, bool) — object and whether it was created
get_or_create returns a tuple (instance, created). created is True if the object was just created, False if it already existed.
Hint: It returns TWO values — unpack them.
What this challenge tests
Output Prediction in Django: orm, get_or_create.