fix imports and styles after refactor

This commit is contained in:
collerek
2020-09-15 12:53:14 +02:00
parent ca21e5dde5
commit 6124830642
7 changed files with 12 additions and 9 deletions

BIN
.coverage

Binary file not shown.

View File

@ -39,4 +39,5 @@ __all__ = [
"NoMatch", "NoMatch",
"ForeignKey", "ForeignKey",
"QuerySet", "QuerySet",
"RelationType",
] ]

View File

@ -1,5 +1,5 @@
from ormar.relations.relation import Relation, RelationType
from ormar.relations.alias_manager import AliasManager from ormar.relations.alias_manager import AliasManager
from ormar.relations.relation import Relation, RelationType
from ormar.relations.relation_manager import RelationsManager from ormar.relations.relation_manager import RelationsManager
__all__ = ["AliasManager", "Relation", "RelationsManager", "RelationType"] __all__ = ["AliasManager", "Relation", "RelationsManager", "RelationType"]

View File

@ -1,10 +1,11 @@
from typing import TYPE_CHECKING, Union, List, Any, Tuple from typing import Any, List, TYPE_CHECKING, Tuple, Union
import ormar import ormar
if TYPE_CHECKING: # pragma no cover if TYPE_CHECKING: # pragma no cover
from ormar.relations import Relation from ormar.relations import Relation
from ormar.models import Model from ormar.models import Model
from ormar.queryset import QuerySet
class QuerysetProxy: class QuerysetProxy:

View File

@ -77,5 +77,3 @@ class Relation:
def __repr__(self) -> str: # pragma no cover def __repr__(self) -> str: # pragma no cover
return str(self.related_models) return str(self.related_models)

View File

@ -1,5 +1,5 @@
from _weakref import proxy from typing import List, Optional, TYPE_CHECKING, Tuple, Type, Union
from typing import List, Type, Optional, Union, Tuple from weakref import proxy
import ormar import ormar
from ormar.exceptions import RelationshipInstanceError 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 import Relation
from ormar.relations.relation import RelationType from ormar.relations.relation import RelationType
if TYPE_CHECKING: # pragma no cover
from ormar import Model
class RelationsManager: class RelationsManager:
def __init__( def __init__(
@ -125,4 +128,4 @@ class RelationsManager:
if name in item._orm: if name in item._orm:
relation_name = item.resolve_relation_name(related_model, item) relation_name = item.resolve_relation_name(related_model, item)
item._orm.remove(name, related_model) item._orm.remove(name, related_model)
related_model._orm.remove(relation_name, item) related_model._orm.remove(relation_name, item)

View File

@ -40,8 +40,8 @@ class RelationProxy(list):
kwargs = {f"{owner_table}__{pkname}": pk_value} kwargs = {f"{owner_table}__{pkname}": pk_value}
queryset = ( queryset = (
ormar.QuerySet(model_cls=self.relation.to) ormar.QuerySet(model_cls=self.relation.to)
.select_related(owner_table) .select_related(owner_table)
.filter(**kwargs) .filter(**kwargs)
) )
return queryset return queryset