tabletop-frog/ttfrog/webserver/widgets.py

22 lines
647 B
Python
Raw Normal View History

2024-01-28 22:14:50 -08:00
import tw2.core as twc
2024-01-28 14:31:50 -08:00
import tw2.forms
2024-01-28 22:14:50 -08:00
from ttfrog.db import db
2024-01-28 14:31:50 -08:00
class CharacterSheet(tw2.forms.Form):
action = ''
2024-01-28 22:14:50 -08:00
class child(tw2.forms.TableLayout):
name = tw2.forms.TextField(validator=twc.Required)
level = tw2.forms.SingleSelectField(
prompt_text=None,
options=range(1, 21),
validator=twc.validation.IntValidator(min=1, max=20)
)
ancestry_name = tw2.forms.SingleSelectField(
label='Ancestry',
prompt_text=None,
options=twc.Deferred(lambda: [a.name for a in db.query(db.ancestry)]),
validator=twc.Required,
)