Add `first_or_none`
Opened this issue · 0 comments
dekoza commented
Is your feature request related to a problem? Please describe.
I'm coming from Django and I'm used to having first()
return None if there are no matches. Ormar should either replicate this behavior or introduce first_or_none
method to go in sync with other _or_none
methods.
Side note: Documentation for get()
and get_or_none()
is misleading as it reads "Returns first row" which sadly is not true because it raises MultipleMatches
if there are more rows matching criteria.
Describe the solution you'd like
I already have a PR adding first_or_none
but the docs suggest opening an issue beforehand 😉
Side note: mypy's pre-commit hook yields a lot of errors from other code in the repo.