From 6124830642b60d8e1985f6f4f771d056dbaf2bbb Mon Sep 17 00:00:00 2001 From: collerek Date: Tue, 15 Sep 2020 12:53:14 +0200 Subject: [PATCH] fix imports and styles after refactor --- .coverage | Bin 53248 -> 53248 bytes ormar/__init__.py | 1 + ormar/relations/__init__.py | 2 +- ormar/relations/querysetproxy.py | 3 ++- ormar/relations/relation.py | 2 -- ormar/relations/relation_manager.py | 9 ++++++--- ormar/relations/relation_proxy.py | 4 ++-- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.coverage b/.coverage index 86117f63199f8d0c65a67ddc3f30aa932aee16b0..d26287896a90bc7f0b4af597b54112f23ac2f202 100644 GIT binary patch delta 265 zcmZozz}&Ead4qvItErKdsmW$j{Z9hShj@B6YdMJVOs@73WE7g*>toF*I9b47ezKe| zmq1Z!PGU)Bex6=IrKJEfL*?WNK5CO4d<2+G_(5tm%lYy$a~|dqxCvO8A%pb1+GLi?$NWsa0F str: # pragma no cover return str(self.related_models) - - diff --git a/ormar/relations/relation_manager.py b/ormar/relations/relation_manager.py index 8dc1e21..1407182 100644 --- a/ormar/relations/relation_manager.py +++ b/ormar/relations/relation_manager.py @@ -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) \ No newline at end of file + related_model._orm.remove(relation_name, item) diff --git a/ormar/relations/relation_proxy.py b/ormar/relations/relation_proxy.py index a3bdebd..8b0ff34 100644 --- a/ormar/relations/relation_proxy.py +++ b/ormar/relations/relation_proxy.py @@ -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