2022-03-20 11:24:33 +01:00
|
|
|
"""Form object declaration."""
|
2024-04-21 20:44:08 +02:00
|
|
|
|
2022-03-20 11:24:33 +01:00
|
|
|
from flask_wtf import FlaskForm
|
2024-04-21 20:44:08 +02:00
|
|
|
from wtforms import BooleanField, SubmitField
|
2022-03-20 11:24:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
class AdminUserForm(FlaskForm):
|
|
|
|
"""Admin Userform form."""
|
2022-03-20 19:23:39 +01:00
|
|
|
|
|
|
|
def user_list_form_builder(users):
|
|
|
|
class UserListForm(AdminUserForm):
|
|
|
|
pass
|
|
|
|
|
2024-04-21 20:44:08 +02:00
|
|
|
for i, user in enumerate(users):
|
2022-03-20 19:23:39 +01:00
|
|
|
setattr(
|
|
|
|
UserListForm,
|
|
|
|
f"user_{i}",
|
|
|
|
BooleanField(label=user.email),
|
|
|
|
)
|
|
|
|
|
|
|
|
return UserListForm()
|
|
|
|
|
2022-03-28 18:48:31 +02:00
|
|
|
tutors = SubmitField("Are tutors")
|
|
|
|
|
|
|
|
nottutors = SubmitField("Are not tutors")
|
2022-03-20 11:24:33 +01:00
|
|
|
|
|
|
|
delete = SubmitField("Delete")
|