pallets-eco / flask-security

Quick and simple security for Flask applications
MIT License
649 stars 154 forks source link

make default for update_datetime column configurable #1018

Closed dodumosu closed 3 months ago

dodumosu commented 4 months ago

thanks for all the hard work on this.

i'm not sure how to put this, but let me have a go: my base model is from advanced-alchemy, and uses aware columns. that means that my user table got created with the PostgreSQL type TIMESTAMPTZ for all columns, including the update_datetime column, which is hardwired to default to a naive datetime. also, setting SECURITY_DATETIME_FACTORY didn't help.

mentioning because the message i got was a serious red herring ("tzinfo is required"), but it was not being generated for the column I thought it was getting generated for.

jwag956 commented 3 months ago

Seems like you are using the shipped fsqla models - right? If so then the easiest thing to do is to simply redefine the column in your User model: I assume you have something like:

class User(db.Model, fsqla.FsUserMixin):
   xx here you can redefine any column you want and change the ORM type.