marshmallow-sqlalchemy icon indicating copy to clipboard operation
marshmallow-sqlalchemy copied to clipboard

Use AwareDateTime when generating field from DateTime(timezone=True)

Open lafrech opened this issue 4 years ago • 0 comments

I didn't investigate this. I don't know if there would be an issue with this.

Basically, when I have a model with

creation_date = sqla.Column(sqla.DateTime(timezone=True), nullable=False)

I need to override the auto field in the schema

class ItemSchema(AutoSchema):
    class Meta:
        model = Item

    id = msa.auto_field(dump_only=True)
    creation_date = ma.fields.AwareDateTime(required=True)

I suppose this could be automatized.

lafrech avatar Aug 31 '21 15:08 lafrech