About the administrator mailbox setting in flask web development?

Why is my interface no different from that of an ordinary user when I create an administrator user? My administrator mailbox is set as follows, that is, my QQ Mail. The last two pictures are the creation interfaces for ordinary users and administrator users.


Mar.01,2021

there is another judgment and setting that needs to be made in models.py.

class User(UserMixin, db.Model):
    -sharp ...
    def __init__(self, **kwargs):
        super(User, self).__init__(**kwargs)
        if self.role is None:
            if self.email == current_app.config['FLASKY_ADMIN']:
                self.role = Role.query.filter_by(permissions=0xff).first()
            if self.role is None:
                self.role = Role.query.filter_by(default=True).first()

this is the original code in the dog book. You can also take a closer look at Chapter 9 of the dog book, "user roles"

.
Menu