add pagination method, add tests, update api docs, bump version, add release info
This commit is contained in:
@ -94,7 +94,7 @@ to produce sqlalchemy.ForeignKeys
|
||||
#### ForeignKey
|
||||
|
||||
```python
|
||||
ForeignKey(to: Union[Type["Model"], "ForwardRef"], *, name: str = None, unique: bool = False, nullable: bool = True, related_name: str = None, virtual: bool = False, onupdate: str = None, ondelete: str = None, **kwargs: Any, ,) -> Any
|
||||
ForeignKey(to: "ToType", *, name: str = None, unique: bool = False, nullable: bool = True, related_name: str = None, virtual: bool = False, onupdate: str = None, ondelete: str = None, **kwargs: Any, ,) -> Any
|
||||
```
|
||||
|
||||
Despite a name it's a function that returns constructed ForeignKeyField.
|
||||
|
||||
@ -24,7 +24,7 @@ pydantic field to use and type of the target column field.
|
||||
#### ManyToMany
|
||||
|
||||
```python
|
||||
ManyToMany(to: Union[Type["Model"], ForwardRef], through: Union[Type["Model"], ForwardRef], *, name: str = None, unique: bool = False, virtual: bool = False, **kwargs: Any, ,) -> Any
|
||||
ManyToMany(to: "ToType", through: "ToType", *, name: str = None, unique: bool = False, virtual: bool = False, **kwargs: Any, ,) -> Any
|
||||
```
|
||||
|
||||
Despite a name it's a function that returns constructed ManyToManyField.
|
||||
|
||||
@ -444,6 +444,25 @@ each=True flag to affect whole table.
|
||||
|
||||
`(int)`: number of deleted rows
|
||||
|
||||
<a name="queryset.queryset.QuerySet.paginate"></a>
|
||||
#### paginate
|
||||
|
||||
```python
|
||||
| paginate(page: int, page_size: int = 20) -> "QuerySet"
|
||||
```
|
||||
|
||||
You can paginate the result which is a combination of offset and limit clauses.
|
||||
Limit is set to page size and offset is set to (page-1) * page_size.
|
||||
|
||||
**Arguments**:
|
||||
|
||||
- `page_size (int)`: numbers of items per page
|
||||
- `page (int)`: page number
|
||||
|
||||
**Returns**:
|
||||
|
||||
`(QuerySet)`: QuerySet
|
||||
|
||||
<a name="queryset.queryset.QuerySet.limit"></a>
|
||||
#### limit
|
||||
|
||||
|
||||
@ -416,6 +416,27 @@ Actual call delegated to QuerySet.
|
||||
|
||||
`(QuerysetProxy)`: QuerysetProxy
|
||||
|
||||
<a name="relations.querysetproxy.QuerysetProxy.paginate"></a>
|
||||
#### paginate
|
||||
|
||||
```python
|
||||
| paginate(page: int, page_size: int = 20) -> "QuerysetProxy"
|
||||
```
|
||||
|
||||
You can paginate the result which is a combination of offset and limit clauses.
|
||||
Limit is set to page size and offset is set to (page-1) * page_size.
|
||||
|
||||
Actual call delegated to QuerySet.
|
||||
|
||||
**Arguments**:
|
||||
|
||||
- `page_size (int)`: numbers of items per page
|
||||
- `page (int)`: page number
|
||||
|
||||
**Returns**:
|
||||
|
||||
`(QuerySet)`: QuerySet
|
||||
|
||||
<a name="relations.querysetproxy.QuerysetProxy.limit"></a>
|
||||
#### limit
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
# 0.8.1
|
||||
|
||||
## Features
|
||||
|
||||
* Introduce processing of `ForwardRef` in relations.
|
||||
Now you can create self-referencing models - both `ForeignKey` and `ManyToMany` relations.
|
||||
`ForwardRef` can be used both for `to` and `through` `Models`.
|
||||
@ -13,8 +15,13 @@
|
||||
unless two different relation were used
|
||||
(two relation fields with different names)
|
||||
```
|
||||
* Introduce the `paginate` method that allows to limit/offset by `page` and `page_size`.
|
||||
Available for `QuerySet` and `QuerysetProxy`.
|
||||
|
||||
## Other
|
||||
|
||||
* Refactoring and performance optimization in queries and joins.
|
||||
* Update API docs and docs.
|
||||
* Update API docs and docs -> i.e. split of queries documentation.
|
||||
|
||||
# 0.8.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user