tabletop-frog/ttfrog/webserver/forms.py

13 lines
471 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)
self.choices = 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)
self.choices = db.query(model).all()