add more test with inheritance, fix ordering of subquery in first and get, regenerate api docs with only documented items
This commit is contained in:
@ -1,9 +1,6 @@
|
||||
<a name="models.helpers.relations"></a>
|
||||
# models.helpers.relations
|
||||
|
||||
<a name="models.helpers.relations.alias_manager"></a>
|
||||
#### alias\_manager
|
||||
|
||||
<a name="models.helpers.relations.register_relation_on_build"></a>
|
||||
#### register\_relation\_on\_build
|
||||
|
||||
|
||||
@ -1,59 +1,6 @@
|
||||
<a name="models.metaclass"></a>
|
||||
# models.metaclass
|
||||
|
||||
<a name="models.metaclass.PARSED_FIELDS_KEY"></a>
|
||||
#### PARSED\_FIELDS\_KEY
|
||||
|
||||
<a name="models.metaclass.CONFIG_KEY"></a>
|
||||
#### CONFIG\_KEY
|
||||
|
||||
<a name="models.metaclass.ModelMeta"></a>
|
||||
## ModelMeta Objects
|
||||
|
||||
```python
|
||||
class ModelMeta()
|
||||
```
|
||||
|
||||
Class used for type hinting.
|
||||
Users can subclass this one for convenience but it's not required.
|
||||
The only requirement is that ormar.Model has to have inner class with name Meta.
|
||||
|
||||
<a name="models.metaclass.ModelMeta.tablename"></a>
|
||||
#### tablename
|
||||
|
||||
<a name="models.metaclass.ModelMeta.table"></a>
|
||||
#### table
|
||||
|
||||
<a name="models.metaclass.ModelMeta.metadata"></a>
|
||||
#### metadata
|
||||
|
||||
<a name="models.metaclass.ModelMeta.database"></a>
|
||||
#### database
|
||||
|
||||
<a name="models.metaclass.ModelMeta.columns"></a>
|
||||
#### columns
|
||||
|
||||
<a name="models.metaclass.ModelMeta.constraints"></a>
|
||||
#### constraints
|
||||
|
||||
<a name="models.metaclass.ModelMeta.pkname"></a>
|
||||
#### pkname
|
||||
|
||||
<a name="models.metaclass.ModelMeta.model_fields"></a>
|
||||
#### model\_fields
|
||||
|
||||
<a name="models.metaclass.ModelMeta.alias_manager"></a>
|
||||
#### alias\_manager
|
||||
|
||||
<a name="models.metaclass.ModelMeta.property_fields"></a>
|
||||
#### property\_fields
|
||||
|
||||
<a name="models.metaclass.ModelMeta.signals"></a>
|
||||
#### signals
|
||||
|
||||
<a name="models.metaclass.ModelMeta.abstract"></a>
|
||||
#### abstract
|
||||
|
||||
<a name="models.metaclass.check_if_field_has_choices"></a>
|
||||
#### check\_if\_field\_has\_choices
|
||||
|
||||
@ -233,6 +180,33 @@ Updates Meta parameters in child from parent if needed.
|
||||
- `attrs (Dict)`: new namespace for class being constructed
|
||||
- `model_fields (Dict[str, BaseField])`: ormar fields in defined in current class
|
||||
|
||||
<a name="models.metaclass.copy_and_replace_m2m_through_model"></a>
|
||||
#### copy\_and\_replace\_m2m\_through\_model
|
||||
|
||||
```python
|
||||
copy_and_replace_m2m_through_model(field: Type[ManyToManyField], field_name: str, table_name: str, parent_fields: Dict, attrs: Dict, meta: ModelMeta) -> None
|
||||
```
|
||||
|
||||
Clones class with Through model for m2m relations, appends child name to the name
|
||||
of the cloned class.
|
||||
|
||||
Clones non foreign keys fields from parent model, the same with database columns.
|
||||
|
||||
Modifies related_name with appending child table name after '_'
|
||||
|
||||
For table name, the table name of child is appended after '_'.
|
||||
|
||||
Removes the original sqlalchemy table from metadata if it was not removed.
|
||||
|
||||
**Arguments**:
|
||||
|
||||
- `field (Type[ManyToManyField])`: field with relations definition
|
||||
- `field_name (str)`: name of the relation field
|
||||
- `table_name (str)`: name of the table
|
||||
- `parent_fields (Dict)`: dictionary of fields to copy to new models from parent
|
||||
- `attrs (Dict)`: new namespace for class being constructed
|
||||
- `meta (ModelMeta)`: metaclass of currently created model
|
||||
|
||||
<a name="models.metaclass.copy_data_from_parent_model"></a>
|
||||
#### copy\_data\_from\_parent\_model
|
||||
|
||||
@ -296,6 +270,18 @@ If the class is a ormar.Model it is skipped.
|
||||
|
||||
`(Tuple[Dict, Dict])`: updated attrs and model_fields
|
||||
|
||||
<a name="models.metaclass.ModelMeta"></a>
|
||||
## ModelMeta Objects
|
||||
|
||||
```python
|
||||
class ModelMeta()
|
||||
```
|
||||
|
||||
Class used for type hinting.
|
||||
Users can subclass this one for convenience but it's not required.
|
||||
The only requirement is that ormar.Model has to have inner class with name Meta.
|
||||
|
||||
|
||||
<a name="models.metaclass.ModelMetaclass"></a>
|
||||
## ModelMetaclass Objects
|
||||
|
||||
|
||||
@ -24,9 +24,6 @@ will become:
|
||||
|
||||
`(Dict[str, List])`: list converted to dictionary to avoid repetition and group nested models
|
||||
|
||||
<a name="models.model.T"></a>
|
||||
#### T
|
||||
|
||||
<a name="models.model.Model"></a>
|
||||
## Model Objects
|
||||
|
||||
@ -34,16 +31,6 @@ will become:
|
||||
class Model(NewBaseModel)
|
||||
```
|
||||
|
||||
<a name="models.model.Model.__abstract__"></a>
|
||||
#### \_\_abstract\_\_
|
||||
|
||||
<a name="models.model.Model.__repr__"></a>
|
||||
#### \_\_repr\_\_
|
||||
|
||||
```python
|
||||
| __repr__() -> str
|
||||
```
|
||||
|
||||
<a name="models.model.Model.from_row"></a>
|
||||
#### from\_row
|
||||
|
||||
@ -271,7 +258,7 @@ Sets model save status to True.
|
||||
|
||||
**Raises**:
|
||||
|
||||
- `ModelPersistenceError`: If the pk column is not set will throw ModelPersistenceError
|
||||
- `ModelPersistenceError`: If the pk column is not set
|
||||
|
||||
**Arguments**:
|
||||
|
||||
@ -315,7 +302,7 @@ Does NOT refresh the related models fields if they were loaded before.
|
||||
|
||||
**Raises**:
|
||||
|
||||
- `NoMatch`: If given pk is not found in database the NoMatch exception is raised.
|
||||
- `NoMatch`: If given pk is not found in database.
|
||||
|
||||
**Returns**:
|
||||
|
||||
|
||||
@ -15,9 +15,6 @@ Constructed with ModelMetaclass which in turn also inherits pydantic metaclass.
|
||||
Abstracts away all internals and helper functions, so final Model class has only
|
||||
the logic concerned with database connection and data persistance.
|
||||
|
||||
<a name="models.newbasemodel.NewBaseModel.__slots__"></a>
|
||||
#### \_\_slots\_\_
|
||||
|
||||
<a name="models.newbasemodel.NewBaseModel.__init__"></a>
|
||||
#### \_\_init\_\_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user