through_field
ThroughField
Bases: ForeignKeyField
Field class used to access ManyToMany model through model.
Source code in ormar/fields/through_field.py
| Python | |
|---|---|
69 70 71 72 73 74 75 76 77 78 79 80 | |
kind
property
Returns:
| Type | Description |
|---|---|
RelationKind
|
|
Through(to, *, name=None, related_name=None, **kwargs)
Despite a name it's a function that returns constructed ThroughField. It's a special field populated only for m2m relations. Accepts number of relation setting parameters as well as all BaseField ones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to
|
ToType
|
target related ormar Model |
required |
name
|
Optional[str]
|
name of the database field - later called alias |
None
|
related_name
|
Optional[str]
|
name of reversed FK relation populated for you on to model |
None
|
kwargs
|
Any
|
all other args to be populated by BaseField |
{}
|
Returns:
| Type | Description |
|---|---|
ForeignKeyField
|
ormar ForeignKeyField with relation to selected model |
Source code in ormar/fields/through_field.py
| Python | |
|---|---|
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |