class AllBasicTypesModel(apilib.Model):
    fstring = apilib.Field(apilib.String())
    fint = apilib.Field(apilib.Integer())
    ffloat = apilib.Field(apilib.Float())
    fbool = apilib.Field(apilib.Boolean())
    fdate = apilib.Field(apilib.Date())
    fdatetime = apilib.Field(apilib.DateTime())
    fdecimal = apilib.Field(apilib.Decimal())
    fenum = apilib.Field(apilib.Enum(['Jerry', 'George']))
    fid = apilib.Field(apilib.EncryptedId())
Exemple #2
0
class ToStringModel(apilib.Model):
    fstring = apilib.Field(apilib.String())
    fint = apilib.Field(apilib.Integer())
    ffloat = apilib.Field(apilib.Float())
    fbool = apilib.Field(apilib.Boolean())
    fdate = apilib.Field(apilib.Date())
    fdatetime = apilib.Field(apilib.DateTime())
    fdecimal = apilib.Field(apilib.Decimal())
    fenum = apilib.Field(apilib.Enum(['JERRY', 'GEORGE']))
    fbytes = apilib.Field(apilib.Bytes())
    fchild = apilib.Field(apilib.ModelType(BasicScalarModel))
    lchild = apilib.Field(apilib.ListType(BasicScalarModel))
    dchild = apilib.Field(apilib.DictType(BasicScalarModel))
 class DateRangeModel(apilib.Model):
     fdatetime = apilib.Field(
         apilib.DateTime(),
         validators=[
             apilib.Range(min_=dateparse('2016-01-01 12:30:00-07:00'),
                          max_=dateparse('2016-03-05 14:30:00-07:00'))
         ])
     fdate = apilib.Field(apilib.Date(),
                          validators=[
                              apilib.Range(
                                  min_=dateparse('2016-02-02').date(),
                                  max_=dateparse('2016-03-03').date())
                          ])
Exemple #4
0
class ModelWithDateList(apilib.Model):
    ldate = apilib.Field(apilib.ListType(apilib.Date()))
    ldatetime = apilib.Field(apilib.ListType(apilib.DateTime()))
Exemple #5
0
class ModelWithDates(apilib.Model):
    fdate = apilib.Field(apilib.Date())
    fdatetime = apilib.Field(apilib.DateTime())
 class UniqueDateModel(apilib.Model):
     ldatetime = apilib.Field(apilib.ListType(apilib.DateTime()),
                              validators=[apilib.Unique()])
     ldate = apilib.Field(apilib.ListType(apilib.Date()),
                          validators=[apilib.Unique()])