distribusi-verse/verse/admin_page/forms/admindistribusiform.py

24 lines
603 B
Python
Raw Normal View History

2024-06-02 22:37:55 +02:00
"""Form object declaration."""
from flask_wtf import FlaskForm
from wtforms import BooleanField, SubmitField
class AdminDistribusiForm(FlaskForm):
"""Admin Distribusi form."""
delete = SubmitField("Delete")
def distribusi_list_form_builder(distribusis):
class DistribusiListForm(AdminDistribusiForm):
pass
for i, distribusi in enumerate(distribusis):
setattr(
DistribusiListForm,
f"distribusi_{i}",
BooleanField(label=distribusi.distribusiname),
)
return DistribusiListForm()