tabletop-frog/ttfrog/webserver/controllers/character_sheet.py
2024-02-04 11:40:30 -08:00

23 lines
684 B
Python

from ttfrog.webserver.controllers.base import BaseController, query_factory
from ttfrog.db.schema import Character, Ancestry
from ttfrog.db.manager import db
from wtforms_alchemy import ModelForm, QuerySelectField
from wtforms.validators import InputRequired
class CharacterForm(ModelForm):
class Meta:
model = Character
exclude = ['slug']
def get_session():
return db.session
ancestry = QuerySelectField('Ancestry', validators=[InputRequired()],
query_factory=query_factory(Ancestry), get_label='name')
class CharacterSheet(BaseController):
model = CharacterForm.Meta.model
model_form = CharacterForm