From e0d1e48c02bb7ecb69d18448960f7a722534c644 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Thu, 22 Apr 2021 16:02:04 -0400 Subject: [PATCH 1/2] Fix typo in docstring --- ormar/queryset/queryset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ormar/queryset/queryset.py b/ormar/queryset/queryset.py index 3cf4211..35a1349 100644 --- a/ormar/queryset/queryset.py +++ b/ormar/queryset/queryset.py @@ -888,7 +888,7 @@ class QuerySet(Generic[T]): """ Returns all rows from a database for given model for set filter options. - Passing kwargs is a shortcut and equals to calling `filter(**kwrags).all()`. + Passing kwargs is a shortcut and equals to calling `filter(**kwargs).all()`. If there are no rows meeting the criteria an empty list is returned. From 3e8388b0537746f2e0ec395a1967a6379bbbdf2a Mon Sep 17 00:00:00 2001 From: johnthagen Date: Mon, 26 Apr 2021 09:58:29 -0400 Subject: [PATCH 2/2] Update *args, **kwargs references in get methods --- ormar/queryset/queryset.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ormar/queryset/queryset.py b/ormar/queryset/queryset.py index 35a1349..a240ca6 100644 --- a/ormar/queryset/queryset.py +++ b/ormar/queryset/queryset.py @@ -796,7 +796,8 @@ class QuerySet(Generic[T]): If no criteria set it will return the last row in db sorted by pk. - Passing a criteria is actually calling filter(**kwargs) method described below. + Passing a criteria is actually calling filter(*args, **kwargs) method described + below. If not match is found None will be returned. @@ -816,7 +817,8 @@ class QuerySet(Generic[T]): If no criteria set it will return the last row in db sorted by pk. - Passing a criteria is actually calling filter(**kwargs) method described below. + Passing a criteria is actually calling filter(*args, **kwargs) method described + below. :raises NoMatch: if no rows are returned :raises MultipleMatches: if more than 1 row is returned. @@ -853,10 +855,13 @@ class QuerySet(Generic[T]): """ Combination of create and get methods. - Tries to get a row meeting the criteria fro kwargs + Tries to get a row meeting the criteria for kwargs and if `NoMatch` exception is raised it creates a new one with given kwargs. + Passing a criteria is actually calling filter(*args, **kwargs) method described + below. + :param kwargs: fields names and proper value types :type kwargs: Any :return: returned or created Model @@ -888,7 +893,8 @@ class QuerySet(Generic[T]): """ Returns all rows from a database for given model for set filter options. - Passing kwargs is a shortcut and equals to calling `filter(**kwargs).all()`. + Passing args and/or kwargs is a shortcut and equals to calling + `filter(*args, **kwargs).all()`. If there are no rows meeting the criteria an empty list is returned.