小编one*_*iro的帖子

Flask admin overrides password when user model is changed

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)

python flask flask-admin

5
推荐指数
1
解决办法
1781
查看次数

标签 统计

flask ×1

flask-admin ×1

python ×1