This commit is contained in:
collerek
2021-06-04 15:50:09 +02:00
parent 85c5b7976e
commit 7b92884f39
4 changed files with 73 additions and 7 deletions

View File

@ -2,6 +2,7 @@ import logging
from typing import Dict, List, Optional, TYPE_CHECKING, Tuple, Type, Union
import sqlalchemy
from pydantic.typing import ForwardRef
import ormar # noqa: I100, I202
from ormar.models.descriptors import RelationDescriptor
@ -203,7 +204,7 @@ def _is_through_model_not_set(field: "BaseField") -> bool:
:return: result of the check
:rtype: bool
"""
return field.is_multi and not field.through
return field.is_multi and not field.through and not field.to.__class__ == ForwardRef
def _is_db_field(field: "BaseField") -> bool: