3 ms·
>> and (the worst case) basic control flow. I call it "java-way goto" I can't agree about Class.objects.get - method must return exactly one row by known pk va
by Ingaz 14y ago
>> and (the worst case) basic control flow.
I call it "java-way goto"
I can't agree about Class.objects.get - method must return exactly one row by known pk value.
So it perfectly sane to raise exception for zero rows.
Class.objects.filter is working the way you want.
- dscrd 14y agoExcept that get accepts as parameters non-unique non-primary fields too. I have every reason to believe that the Django devs are capable people who thought about this and landed on this specific usage with a clear rationale... but it still is a misuse of error handling capabilities of a language. And a sort of misuse that everyone else does sometimes as well.