fix imports and styles after refactor
This commit is contained in:
@ -39,4 +39,5 @@ __all__ = [
|
||||
"NoMatch",
|
||||
"ForeignKey",
|
||||
"QuerySet",
|
||||
"RelationType",
|
||||
]
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from ormar.relations.relation import Relation, RelationType
|
||||
from ormar.relations.alias_manager import AliasManager
|
||||
from ormar.relations.relation import Relation, RelationType
|
||||
from ormar.relations.relation_manager import RelationsManager
|
||||
|
||||
__all__ = ["AliasManager", "Relation", "RelationsManager", "RelationType"]
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
from typing import TYPE_CHECKING, Union, List, Any, Tuple
|
||||
from typing import Any, List, TYPE_CHECKING, Tuple, Union
|
||||
|
||||
import ormar
|
||||
|
||||
if TYPE_CHECKING: # pragma no cover
|
||||
from ormar.relations import Relation
|
||||
from ormar.models import Model
|
||||
from ormar.queryset import QuerySet
|
||||
|
||||
|
||||
class QuerysetProxy:
|
||||
|
||||
@ -77,5 +77,3 @@ class Relation:
|
||||
|
||||
def __repr__(self) -> str: # pragma no cover
|
||||
return str(self.related_models)
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from _weakref import proxy
|
||||
from typing import List, Type, Optional, Union, Tuple
|
||||
from typing import List, Optional, TYPE_CHECKING, Tuple, Type, Union
|
||||
from weakref import proxy
|
||||
|
||||
import ormar
|
||||
from ormar.exceptions import RelationshipInstanceError
|
||||
@ -8,6 +8,9 @@ from ormar.fields.many_to_many import ManyToManyField
|
||||
from ormar.relations import Relation
|
||||
from ormar.relations.relation import RelationType
|
||||
|
||||
if TYPE_CHECKING: # pragma no cover
|
||||
from ormar import Model
|
||||
|
||||
|
||||
class RelationsManager:
|
||||
def __init__(
|
||||
@ -125,4 +128,4 @@ class RelationsManager:
|
||||
if name in item._orm:
|
||||
relation_name = item.resolve_relation_name(related_model, item)
|
||||
item._orm.remove(name, related_model)
|
||||
related_model._orm.remove(relation_name, item)
|
||||
related_model._orm.remove(relation_name, item)
|
||||
|
||||
@ -40,8 +40,8 @@ class RelationProxy(list):
|
||||
kwargs = {f"{owner_table}__{pkname}": pk_value}
|
||||
queryset = (
|
||||
ormar.QuerySet(model_cls=self.relation.to)
|
||||
.select_related(owner_table)
|
||||
.filter(**kwargs)
|
||||
.select_related(owner_table)
|
||||
.filter(**kwargs)
|
||||
)
|
||||
return queryset
|
||||
|
||||
|
||||
Reference in New Issue
Block a user