Ejemplo n.º 1
0
    def setUp(self):
        super(TestModelFormWithDb, self).setUp()
        self.user_table = self.db.define_table(
            "user", Field("name"),
        )
        self.profile_table = self.db.define_table(
            "profile", Field("user", "reference user"),
        )

        self.F = model_form(self.profile_table, field_args={
            "user": {"widget": LazySelect()}
        })
        self.form = self.F()
Ejemplo n.º 2
0
 def setUp(self):
     super(TestModelForm, self).setUp()
     self.table = self.db.define_table(
         "user",
         Field("name", label="The Name", required=True, length=20),
         Field("age", "integer", required=True, comment="User's age",
               requires=IS_INT_IN_RANGE(0, 100)),
         Field("eye_color"),
         Field("sex", requires=IS_EMPTY_OR(
                               IS_IN_SET(("male", "female")))),
         Field("get_spam_from_us", "boolean", default=True),
     )
     self.F = model_form(self.table, field_args={
         "sex": {"widget": LazySelect()}
     })
     self.form = self.F()
Ejemplo n.º 3
0
 def setUp(self):
     super(TestAllFieldTypes, self).setUp()
     self.table = self.db.define_table(
         "all_field_table",
         Field("string", "string"),
         Field("text", "text"),
         Field("boolean", "boolean"),
         Field("integer", "integer"),
         Field("double", "double"),
         Field("decimal", "decimal(3,4)"),
         Field("date", "date"),
         Field("time", "time"),
         Field("datetime", "datetime"),
     )
     F = model_form(self.table)
     self.form = F()