Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add first_or_none #1136

Open
dekoza opened this issue Jul 10, 2023 · 0 comments
Open

Add first_or_none #1136

dekoza opened this issue Jul 10, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@dekoza
Copy link

dekoza commented Jul 10, 2023

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.

@dekoza dekoza added the enhancement New feature or request label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant