Example #1
0
        class Test(Model):
            computed = Field(type=str,
                             computed='get_hello',
                             computed_empty=True)

            def get_hello(self):
                return 'hello'
Example #2
0
        class Test(Model):
            computed = Field(type=dict,
                             computed='get_hello',
                             computed_type=True)

            def get_hello(self):
                return 'hello'
Example #3
0
    def test_field_required(self):

        field = Field(required=True)

        class Test(Model):
            test = field

        self.assertIn(field, Test._required)
Example #4
0
    def test_field_indexed(self):

        field = Field(indexed=True)

        class Test(Model):
            test = field

        self.assertIn(field, Test._indexed)
Example #5
0
    def test_field_model_nested(self):
        class Beta(Model):
            pass

        field = Field(type=Beta)

        class Alpha(Model):
            beta = field

        self.assertIn(field, Alpha._nested)
Example #6
0
    def test_field_model_related(self):
        class Beta(Model):
            pass

        field = Field(type=Beta, related=True)

        class Alpha(Model):
            beta = field

        self.assertIn(field, Alpha._related)
Example #7
0
 class Test(Model):
     field = Field(primary=True)
Example #8
0
 class Alpha(RethinkDBModel):
     beta = Field(type=Beta)
     field = Field(indexed=True)
Example #9
0
 class Beta(RethinkDBModel):
     field = Field(indexed=True)
Example #10
0
 class Test(Model):
     computed = Field(computed='missing_method')
Example #11
0
        class Test(Model):
            computed = Field(computed='value')

            value = 'test'
Example #12
0
 class Beta(Model):
     field = Field()
Example #13
0
        class Test(Model):
            computed = Field(computed='method')

            def method(self):
                pass
Example #14
0
 class Test(Model):
     value = Field()
     object = Field(type=dict)
Example #15
0
 class Test(Model):
     alpha = Field()
     beta = Field()
Example #16
0
 class Test(Model):
     field = Field()
Example #17
0
 class Beta(Model):
     gamma = Field(type=Gamma)
Example #18
0
 class Gamma(Model):
     field = Field()
Example #19
0
 class Test(Model):
     alpha = Field(primary=True)
     beta = Field(primary=True)
Example #20
0
 class Alpha(Model):
     beta = Field(type=Beta)
Example #21
0
 class Test(Model):
     computed = Field(type=str, computed=lambda: 'value')
Example #22
0
 class Beta(Model):
     value = Field()
Example #23
0
 class Test(Model):
     field = Field(required=True)