wip - through models fields -> attached in queries, accesible from instances, creates in add and queryset create

This commit is contained in:
collerek
2021-02-15 17:30:14 +01:00
parent 868243686d
commit 3fd231cf3c
19 changed files with 677 additions and 374 deletions

View File

@ -26,6 +26,7 @@ class RelationType(Enum):
PRIMARY = 1
REVERSE = 2
MULTIPLE = 3
THROUGH = 4
class Relation:
@ -128,7 +129,7 @@ class Relation:
:type child: Model
"""
relation_name = self.field_name
if self._type == RelationType.PRIMARY:
if self._type in (RelationType.PRIMARY, RelationType.THROUGH):
self.related_models = child
self._owner.__dict__[relation_name] = child
else: