Refactor in join in order to make possibility for nested duplicated relations (and it was a mess :D)

This commit is contained in:
collerek
2021-01-15 17:05:23 +01:00
parent d10141ba6f
commit 0fe95b0c7b
14 changed files with 271 additions and 303 deletions

View File

@ -113,6 +113,19 @@ class AliasManager:
if child_key not in self._aliases_new:
self._aliases_new[child_key] = get_table_alias()
def add_alias(self, alias_key: str) -> str:
"""
Adds alias to the dictionary of aliases under given key.
:param alias_key: key of relation to generate alias for
:type alias_key: str
:return: generated alias
:rtype: str
"""
alias = get_table_alias()
self._aliases_new[alias_key] = alias
return alias
def resolve_relation_alias(
self, from_model: Type["Model"], relation_name: str
) -> str:

View File

@ -127,7 +127,7 @@ class RelationProxy(list):
self, item: "Model", keep_reversed: bool = True
) -> None:
"""
Removes the item from relation with parent.
Removes the related from relation with parent.
Through models are automatically deleted for m2m relations.