This commit is contained in:
collerek
2021-08-06 11:59:16 +02:00
parent 0726951738
commit 25adb8378e

View File

@ -275,5 +275,9 @@ class ManyToManyField(ForeignKeyField, ormar.QuerySetProtocol, ormar.RelationPro
"metadata": self.owner.Meta.metadata, "metadata": self.owner.Meta.metadata,
} }
new_meta = type("Meta", (), new_meta_namespace) new_meta = type("Meta", (), new_meta_namespace)
through_model = type(class_name, (ormar.Model,), {"Meta": new_meta}) through_model = type(
class_name,
(ormar.Model,),
{"Meta": new_meta, "id": ormar.Integer(name="id", primary_key=True)},
)
self.through = cast(Type["Model"], through_model) self.through = cast(Type["Model"], through_model)