July 2019
Beginner to intermediate
302 pages
9h 38m
English
Follow these steps in order to implement the lazy evaluation of translations:
from flask_babel import _
class NameForm(FlaskForm):
name = StringField(_('Name'), validators=[InputRequired()])
class ProductForm(NameForm):
price = DecimalField(_('Price'), validators=[
InputRequired(), NumberRange(min=Decimal('0.0'))
])
category = CategoryField(
_('Category'), validators=[InputRequired()], coerce=int
)
image = FileField(_('Product Image'))
class CategoryForm(NameForm):
name = StringField(_('Name'), validators=[
InputRequired(), check_duplicate_category()
])
Notice that all the field labels ...