~homeworkprod/byceps

ref: 4144a29fdeb34e20d44e5cd78a324d9f9f6a2b0d byceps/byceps/blueprints/admin/brand/forms.py -rw-r--r-- 1.2 KiB
4144a29f — Jochen Kupperschmidt Dim archived brands in admin brand navigation dropdown 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
byceps.blueprints.admin.brand.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""

from flask_babel import lazy_gettext
from wtforms import BooleanField, StringField
from wtforms.validators import InputRequired, Length, Optional

from ....util.l10n import LocalizedForm


class _BaseForm(LocalizedForm):
    title = StringField(
        lazy_gettext('Title'),
        validators=[InputRequired(), Length(min=1, max=40)],
    )


class CreateForm(_BaseForm):
    id = StringField(
        lazy_gettext('ID'), validators=[InputRequired(), Length(min=1, max=20)]
    )


class UpdateForm(_BaseForm):
    image_filename = StringField(
        lazy_gettext('Image filename'), validators=[Optional()]
    )
    archived = BooleanField(lazy_gettext('archived'))


class EmailConfigUpdateForm(LocalizedForm):
    sender_address = StringField(
        lazy_gettext('Sender address'), validators=[InputRequired()]
    )
    sender_name = StringField(
        lazy_gettext('Sender name'), validators=[Optional()]
    )
    contact_address = StringField(
        lazy_gettext('Contact address'), validators=[Optional()]
    )