diff --git a/app/models.py b/app/models.py index df992ccb..2800e767 100644 --- a/app/models.py +++ b/app/models.py @@ -578,10 +578,11 @@ class User(HashidMixin, UserMixin, db.Model): def __init__(self, **kwargs): if 'role' not in kwargs: - if kwargs['email'] == current_app.config['NOPAQUE_ADMIN']: - kwargs['role'] = Role.query.filter_by(name='Administrator').first() - else: - kwargs['role'] = Role.query.filter_by(default=True).first() + kwargs['role'] = ( + Role.query.filter_by(name='Administrator').first() + if kwargs['email'] == current_app.config['NOPAQUE_ADMIN'] + else Role.query.filter_by(default=True).first() + ) super().__init__(**kwargs) def __repr__(self):