tabletop-frog/ttfrog/webserver/forms.py

14 lines
536 B
Python
Raw Normal View History

2024-02-08 01:14:35 -08:00
from ttfrog.db.manager import db
from wtforms.fields import SelectField, SelectMultipleField
2024-02-04 11:40:30 -08:00
2024-02-08 01:14:35 -08:00
class DeferredSelectMultipleField(SelectMultipleField):
def __init__(self, *args, model=None, **kwargs):
super().__init__(*args, **kwargs)
2024-02-18 19:30:41 -08:00
self.choices = [(rec.id, rec.name) for rec in db.query(model).all()]
2024-02-04 11:40:30 -08:00
2024-02-08 01:14:35 -08:00
class DeferredSelectField(SelectField):
def __init__(self, *args, model=None, **kwargs):
super().__init__(*args, **kwargs)
2024-02-18 19:30:41 -08:00
self.choices = [(rec.id, rec.name) for rec in db.query(model).all()]