2024-02-04 15:38:54 -08:00
|
|
|
from ttfrog.webserver.controllers.base import BaseController, DeferredSelectField
|
2024-02-04 11:40:30 -08:00
|
|
|
from ttfrog.db.schema import Character, Ancestry
|
2024-02-04 15:38:54 -08:00
|
|
|
from wtforms_alchemy import ModelForm
|
2024-02-04 15:22:54 -08:00
|
|
|
from wtforms.fields import SubmitField
|
2024-02-04 11:40:30 -08:00
|
|
|
|
|
|
|
|
|
|
|
class CharacterForm(ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Character
|
|
|
|
exclude = ['slug']
|
|
|
|
|
2024-02-04 15:22:54 -08:00
|
|
|
save = SubmitField()
|
|
|
|
delete = SubmitField()
|
2024-02-04 15:38:54 -08:00
|
|
|
ancestry = DeferredSelectField('Ancestry', model=Ancestry, coerce=str, validate_choice=True)
|
2024-01-28 14:31:50 -08:00
|
|
|
|
|
|
|
|
2024-01-31 22:39:54 -08:00
|
|
|
class CharacterSheet(BaseController):
|
2024-02-04 11:40:30 -08:00
|
|
|
model = CharacterForm.Meta.model
|
|
|
|
model_form = CharacterForm
|