我在理解 Flask 中的 UserMixin 时遇到问题

I am getting a problem while understanding the UserMixin in Flask

我目前正在学习 flask,我听说过 UserMixin 这个概念,谁能告诉我它是什么意思以及它是如何工作的。

UserMixinflask-login package that implements user authentication functionality. In order for flask-login to work, it expects your User object to have certain pre-defined methods, like get_id(), is_authenticated(), etc (you can see what these are in the docs here 的一部分)。从技术上讲,您不必使用 mixin 并自己实现这些方法,但是从 mixin 扩展是一个很好的捷径。