Exemplo n.º 1
0
class AuthenticationForm(mf.Form):
    name = mf.String()
    password = mf.String(validate=MLength(5))
    password_confirm = mf.String()

    @mf.Form.validator
    def same(schema, data):
        if data["password"] != data["password_confirm"]:
            raise ValidationError("not same!", "password")
Exemplo n.º 2
0
class PersonForm(mf.Form):
    name = mf.String()
    age = mf.String()
    birth = mf.Nested(DateTriple)

    class Meta:
        layout = Layout([
            LColumn("name", widget="default"),
            LColumn("age", widget="default"),
            LColumn("birth.year", "birth.month", "birth.day", widget="date"),
        ])
Exemplo n.º 3
0
class PersonForm(mf.Form):
    name = mf.String()
    birth = mf.Date()

    @mf.Form.accessor
    def access(self, k, ob):
        return getattr(ob, k)
Exemplo n.º 4
0
class Form(mf.Form):
    name = mf.String(required=False)

    @mf.Form.preprocessor
    def case_insensitive(self, data):
        data["name"] = data["name"].lower()
        return data
Exemplo n.º 5
0
class StudentForm(mf.Form):
    name = mf.String(placeholder="foo")
    age = mf.Int(placeholder="0")
    color = mf.Select([
        (i, c) for i, c in enumerate(["red", "blue", "green", "yellow"])
    ])
    group = mf.Select([("group1", [("a", "a"), ("b", "b")]),
                       ("group2", [("x", "x"), ("y", "y")])],
                      optgroup=True)
Exemplo n.º 6
0
class HasName(mf.Form):
    name = mf.String(doc="name of hasname")
    ctime = mf.Nested(DateTriple)
Exemplo n.º 7
0
 class Base(Class):
     name = mf.String(doc="base")
Exemplo n.º 8
0
class AuthenticationForm(mf.Form):
    name = mf.String()
    password = mf.String()
    password_confirm = mf.String()
Exemplo n.º 9
0
        class PersonForm(Class):
            name = mf.String()
            age = mf.Int()

            def make_object(self, kwargs):
                return Person(**kwargs)
Exemplo n.º 10
0
 class Name(Class):
     name = mf.String()
Exemplo n.º 11
0
 class PersonForm(self._getTarget()):
     name = mf.String(doc="名前")
     age = mf.Integer()
Exemplo n.º 12
0
 class PersonForm(self._getTarget()):
     name = mf.String(doc="名前", __call__=input_tag)
     age = mf.Integer()
Exemplo n.º 13
0
class PersonForm(mf.Form):
    name = mf.String()
    birth = mf.Date()
Exemplo n.º 14
0
class StudentForm(PersonForm):
    grade = mf.String()
Exemplo n.º 15
0
class PersonForm(mf.Form):
    name = mf.String(__call__=input_tag, type="text")
    age = mf.Int(__call__=input_tag, type="number")
Exemplo n.º 16
0
class FileForm(mf.Form):
    name = mf.String()
    ctime = mf.Nested(DateTriple)
Exemplo n.º 17
0
 class Form(Class):
     name = mf.String()
     birth = mf.Date()
Exemplo n.º 18
0
 class X(Class):
     name = mf.String(required=False)
Exemplo n.º 19
0
 class ParentsForm(Class):
     yagou = mf.String()
     father = mf.Nested(PersonForm)
     mother = mf.Nested(PersonForm)
Exemplo n.º 20
0
 class AddressForm(mf.Form):
     country = mf.String()
     prefecture = mf.String()
     city = mf.String()
     street = mf.String()
Exemplo n.º 21
0
 class InformationForm(mf.Form):
     zip = mf.String()
     tel = mf.String()
     address = mf.Nested(AddressForm)
Exemplo n.º 22
0
class PersonForm(mf.Form):
    name = mf.String()
    age = mf.Int()
Exemplo n.º 23
0
 def _makeString(self, *args, **kwargs):
     import marshmallow_form as mf
     return mf.String(*args, **kwargs)
Exemplo n.º 24
0
class PersonForm(mf.Form):
    name = mf.String(label="名前", placeholder="foo", widget="str")
    age = mf.Integer(label="年齢", placeholder="0", widget="int")
Exemplo n.º 25
0
class Form(mf.Form):
    name = mf.String(validate=Length(10))

    @mf.Form.error_handler
    def handle_errors(schema, errors, obj):
        raise Exception(errors)
Exemplo n.º 26
0
 class FileForm(self._getTarget()):
     name = mf.String()
     ctime = mf.Nested(DateTriple)
Exemplo n.º 27
0
 class Base(Class):
     name = mf.String()