I am currently diving into a flask project and try to use flask-admin for the first time. Everything is working fine so far, but one thing really bothers me: Whenever I edit my User model the users password gets overwritten. I am following the advice given in the second answer of this question to prevent flask-admin from re-hashing my password. Unfortunately the emptied password field still gets written to the database.
我试图从User-Model那里获取当前密码,该密码作为on_model_change方法的参数,但是在某种程度上该密码似乎已经被覆盖(或者这不是我在这里查看的实际数据库模型-我是有点困惑)。
这是我的代码:
class User(UserMixin, …Run Code Online (Sandbox Code Playgroud)