You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 18, 2024. It is now read-only.
I am using Djantic in my project, and I would like to base a base class between ModelSchema and my individual model schemata, to implement a to_orm method directly on the ModelSchema, as in my complex case simply doing DjangoModel(**schema) doesn't work because of foreign keys and some other data transformations required. I could just implement it on each of them individually, but then mypy will be very unhappy.
I would like to be able to do the following:
class ModelSchemaToORM(ModelSchema):
# either this, django model style
class Meta:
abstract = True
# or this
class Config:
abstract = True
async def to_orm(self):
raise NotImplementedError
Currently the two versions above yield
pydantic.errors.ConfigError: 'Config' (Is `Config` class defined?)
and
pydantic.errors.ConfigError: type object 'Config' has no attribute 'model' (Is `Config.model` a valid Django model class?)
respectively.
Does it make sense to folks here to add an additional condition to ModelSchemaMetaclass to skip Config checks on abstract subclasses? It could either be in Meta or Config, I don't really mind as long as there is a way to put intermediate parents between my ModelSchemata and Djantic's ModelSchema.
The text was updated successfully, but these errors were encountered:
I am using Djantic in my project, and I would like to base a base class between
ModelSchema
and my individual model schemata, to implement ato_orm
method directly on theModelSchema
, as in my complex case simply doingDjangoModel(**schema)
doesn't work because of foreign keys and some other data transformations required. I could just implement it on each of them individually, but then mypy will be very unhappy.I would like to be able to do the following:
Currently the two versions above yield
and
respectively.
Does it make sense to folks here to add an additional condition to
ModelSchemaMetaclass
to skipConfig
checks on abstract subclasses? It could either be inMeta
orConfig
, I don't really mind as long as there is a way to put intermediate parents between my ModelSchemata and Djantic'sModelSchema
.The text was updated successfully, but these errors were encountered: