Skip to content

Commit

Permalink
mypy update fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eadwinCode committed Jan 20, 2022
1 parent b0306d8 commit b3acc13
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ninja_schema/orm/model_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def clone_field(cls, field: FieldInfo, **kwargs: Any) -> FieldInfo:

def model_fields(self) -> Iterator[Field]:
"""returns iterator with all the fields that can be part of schema"""
for fld in self.model._meta.get_fields():
for fld in self.model._meta.get_fields(): # type: ignore
if isinstance(fld, (ManyToOneRel, ManyToManyRel)):
# skipping relations
continue
Expand Down Expand Up @@ -281,16 +281,16 @@ def is_field_in_optional(self, field_name: str) -> bool:

def process_build_schema_parameters(self) -> None:
model_pk = getattr(
self.model._meta.pk,
self.model._meta.pk, # type: ignore
"name",
getattr(self.model._meta.pk, "attname"),
getattr(self.model._meta.pk, "attname"), # type: ignore
) # no type:ignore
if (
model_pk not in self.include
and model_pk not in self.exclude
and ALL_FIELDS not in self.optional
):
self.optional.add(model_pk)
self.optional.add(str(model_pk))


class ModelSchemaMetaclass(ModelMetaclass):
Expand Down

0 comments on commit b3acc13

Please sign in to comment.