mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-26 19:34:19 +00:00
19 lines
608 B
Python
19 lines
608 B
Python
from app.models import Role
|
|
from flask_wtf import FlaskForm
|
|
from wtforms import BooleanField, SelectField, SubmitField
|
|
|
|
|
|
class AdminEditUserForm(FlaskForm):
|
|
confirmed = BooleanField('Confirmed')
|
|
role = SelectField('Role')
|
|
submit = SubmitField('Submit')
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.role.choices = [(x.hashid, x.name) for x in Role.query.all()]
|
|
|
|
def prefill(self, user):
|
|
''' Pre-fill the form with data of an exististing user '''
|
|
self.confirmed.data = user.confirmed
|
|
self.role.data = user.role.hashid
|