Fetches a single record for a Model type using the provided filter parameters or None. .. code-block:: python3 user = await User.get_or_none(username="foo") :param using_db: The specific DB connection to use. :param args: Q functions containing constra
(
cls, *args: Q, using_db: BaseDBAsyncClient | None = None, **kwargs: Any
)
| 1606 | |
| 1607 | @classmethod |
| 1608 | def get_or_none( |
| 1609 | cls, *args: Q, using_db: BaseDBAsyncClient | None = None, **kwargs: Any |
| 1610 | ) -> QuerySetSingle[Self | None]: |
| 1611 | """ |
| 1612 | Fetches a single record for a Model type using the provided filter parameters or None. |
| 1613 | |
| 1614 | .. code-block:: python3 |
| 1615 | |
| 1616 | user = await User.get_or_none(username="foo") |
| 1617 | |
| 1618 | :param using_db: The specific DB connection to use. |
| 1619 | :param args: Q functions containing constraints. Will be AND'ed. |
| 1620 | :param kwargs: Simple filter constraints. |
| 1621 | """ |
| 1622 | return cls._db_queryset(using_db).get_or_none(*args, **kwargs) |
| 1623 | |
| 1624 | @classmethod |
| 1625 | async def fetch_for_list( |