#Django database error

10 messages · Page 1 of 1 (latest)

livid basalt
#

The error is super clear

#

If you install django-fastdev the error becomes a bit clearer as it will tell you the filters it searched for though.. so that might be useful

upper whale
#

That's most likely doing SomeModel.objects.get(...) it expects exactly 1 result

livid basalt
#

It even tells you how many it found (up to some cutoff), which is unusually helpful :P

upper whale
#

That's for multiple results, for 0 I thought it was this exception

livid basalt
#

ah, sorry, I misunderstood what you said. Yes, the code is using .get(). I hope he already knew that, but that's correct, we shouldn't assume.

upper whale
#

Write code that doesn't fail on missing data

#

What "what"?
We don't even know the exact problem, we only have seen a picture of an error. We supposed what general problem it probably is.
If you want more detailed help, give us more detailed story

#

We don't do debugging by picture, we are not 🧙‍♀️