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

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

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

        field = Field(required=True)

        class Test(Model):
            test = field

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

        field = Field(indexed=True)

        class Test(Model):
            test = field

        self.assertIn(field, Test._indexed)
예제 #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)
예제 #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)
예제 #7
0
 class Test(Model):
     field = Field(primary=True)
예제 #8
0
 class Alpha(RethinkDBModel):
     beta = Field(type=Beta)
     field = Field(indexed=True)
예제 #9
0
 class Beta(RethinkDBModel):
     field = Field(indexed=True)
예제 #10
0
 class Test(Model):
     computed = Field(computed='missing_method')
예제 #11
0
        class Test(Model):
            computed = Field(computed='value')

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

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