Correct spelling mistakes (#1163)
Co-authored-by: collerek <collerek@gmail.com>
This commit is contained in:
@ -238,7 +238,7 @@ def test_excluding_property_field_in_endpoints2():
|
||||
"last_name",
|
||||
"created_date",
|
||||
]
|
||||
# despite being decorated with property_field if you explictly exclude it it will be gone
|
||||
# despite being decorated with property_field if you explicitly exclude it it will be gone
|
||||
assert response.json().get("full_name") is None
|
||||
|
||||
# <==related of code removed for clarity==>
|
||||
|
||||
@ -394,7 +394,7 @@ class Bus2(Car2):
|
||||
```
|
||||
|
||||
`Ormar` automatically modifies related_name of the fields to include the **table** name
|
||||
of the children models. The dafault name is original related_name + '_' + child table name.
|
||||
of the children models. The default name is original related_name + '_' + child table name.
|
||||
|
||||
That way for class Truck2 the relation defined in
|
||||
`owner: Person = ormar.ForeignKey(Person, related_name="owned")` becomes `owned_trucks2`
|
||||
@ -509,13 +509,13 @@ class Category(DateFieldsModel, AuditModel):
|
||||
code: int = ormar.Integer()
|
||||
|
||||
# Note that now the update fields in Category are gone in all places -> ormar fields, pydantic fields and sqlachemy table columns
|
||||
# so full list of available fileds in Category is: ["created_by", "created_date", "id", "name", "code"]
|
||||
# so full list of available fields in Category is: ["created_by", "created_date", "id", "name", "code"]
|
||||
```
|
||||
|
||||
Note how you simply need to provide field names and it will exclude the parent field regardless of from which parent model the field is coming from.
|
||||
|
||||
!!!Note
|
||||
Note that if you want to overwrite a field in child model you do not have to exclude it, simpy overwrite the field declaration in child model with same field name.
|
||||
Note that if you want to overwrite a field in child model you do not have to exclude it, simply overwrite the field declaration in child model with same field name.
|
||||
|
||||
!!!Warning
|
||||
Note that this kind of behavior can confuse mypy and static type checkers, yet accessing the non existing fields will fail at runtime. That's why splitting the base classes is preferred.
|
||||
|
||||
@ -29,7 +29,7 @@ The benefit of using construct is the speed of execution due to skipped validati
|
||||
|
||||
!!!warning
|
||||
Bear in mind that due to skipped validation the `construct` method does not perform any conversions, checks etc.
|
||||
So it's your responsibility to provide tha data that is valid and can be consumed by the database.
|
||||
So it's your responsibility to provide that data that is valid and can be consumed by the database.
|
||||
|
||||
The only two things that construct still performs are:
|
||||
|
||||
@ -45,7 +45,7 @@ therefore it's listed here for clarity.
|
||||
|
||||
Explanation of dict parameters:
|
||||
|
||||
### include (`ormar` modifed)
|
||||
### include (`ormar` modified)
|
||||
|
||||
`include: Union[Set, Dict] = None`
|
||||
|
||||
@ -630,7 +630,7 @@ to_save = {
|
||||
},
|
||||
],
|
||||
}
|
||||
# initializa whole tree
|
||||
# initialize whole tree
|
||||
department = Department(**to_save)
|
||||
|
||||
# save all at once (one after another)
|
||||
|
||||
Reference in New Issue
Block a user