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 AdminDistribusiForm(FlaskForm):
|
|
|
|
"""Admin Distribusi form."""
|
|
|
|
|
|
|
|
delete = SubmitField("Delete")
|
2022-03-20 19:23:39 +01:00
|
|
|
|
|
|
|
def distribusi_list_form_builder(distribusis):
|
|
|
|
class DistribusiListForm(AdminDistribusiForm):
|
|
|
|
pass
|
|
|
|
|
2024-04-21 20:44:08 +02:00
|
|
|
for i, distribusi in enumerate(distribusis):
|
2022-03-20 19:23:39 +01:00
|
|
|
setattr(
|
|
|
|
DistribusiListForm,
|
|
|
|
f"distribusi_{i}",
|
|
|
|
BooleanField(label=distribusi.distribusiname),
|
|
|
|
)
|
|
|
|
|
|
|
|
return DistribusiListForm()
|