update docs, add load_all(), tests for load_all, make through field optional

This commit is contained in:
collerek
2021-03-03 19:48:40 +01:00
parent 9ad1528cc0
commit a8ae50276e
56 changed files with 1653 additions and 653 deletions

View File

@ -27,7 +27,7 @@ Keeps related Models and handles adding/removing of the children.
#### \_\_init\_\_
```python
| __init__(manager: "RelationsManager", type_: RelationType, field_name: str, to: Type["T"], through: Type["T"] = None) -> None
| __init__(manager: "RelationsManager", type_: RelationType, field_name: str, to: Type["Model"], through: Type["Model"] = None) -> None
```
Initialize the Relation and keep the related models either as instances of
@ -73,7 +73,7 @@ Find child model in RelationProxy if exists.
#### add
```python
| add(child: "T") -> None
| add(child: "Model") -> None
```
Adds child Model to relation, either sets child as related model or adds
@ -101,7 +101,7 @@ it from the list in RelationProxy depending on relation type.
#### get
```python
| get() -> Optional[Union[List["T"], "T"]]
| get() -> Optional[Union[List["Model"], "Model"]]
```
Return the related model or models from RelationProxy.