コード例 #1
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
        class Parent(core.Model):
            id = core.SlugAttribute()
            name = core.StringAttribute()

            class Meta(core.Model.Meta):
                attribute_order = ('id', 'name')
                table_format = core.TableFormat.column
コード例 #2
0
ファイル: test_grammar.py プロジェクト: 0u812/obj_tables
        class Parent(core.Model):
            id = core.SlugAttribute()
            name = core.StringAttribute()
            age = core.IntegerAttribute()

            class Meta(core.Model.Meta):
                table_format = core.TableFormat.cell
コード例 #3
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
        class Child(core.Model):
            id = core.SlugAttribute()
            name = core.StringAttribute()
            parents = core.ManyToManyAttribute(Parent, related_name='children')

            class Meta(core.Model.Meta):
                attribute_order = ('id', 'name', 'parents')
コード例 #4
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
        class Child(core.Model):
            id = core.SlugAttribute(verbose_name='Id')
            name = core.StringAttribute(verbose_name='Name')

            class Meta(core.Model.Meta):
                attribute_order = ('id', 'name')
                verbose_name = 'Child'
                verbose_name_plural = 'Child'
コード例 #5
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
        class Child(core.Model):
            id = core.SlugAttribute(verbose_name='Id')
            name = core.StringAttribute(verbose_name='Name')

            class Meta(core.Model.Meta):
                attribute_order = ('id', 'name')
                table_format = core.TableFormat.multiple_cells
                verbose_name = 'Child'
                verbose_name_plural = 'Child'
コード例 #6
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
        class Quantity(core.Model):
            value = core.FloatAttribute()
            units = core.StringAttribute()

            class Meta(core.Model.Meta):
                attribute_order = ('value', 'units')
                table_format = core.TableFormat.multiple_cells

            def serialize(self):
                return '{} {}'.format(value, units)
コード例 #7
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
        class Parent(core.Model):
            quantity_1 = core.OneToOneAttribute('Quantity',
                                                related_name='parent_q_1')
            quantity_2 = core.OneToOneAttribute('Quantity',
                                                related_name='parent_q_2')
            value = core.FloatAttribute()
            units = core.StringAttribute()

            class Meta(core.Model.Meta):
                attribute_order = ('quantity_1', 'quantity_2', 'value',
                                   'units')
コード例 #8
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
        class Parent(core.Model):
            id = core.SlugAttribute(verbose_name='Id')
            name = core.StringAttribute(verbose_name='Name')
            child = core.ManyToOneAttribute(Child,
                                            related_name='parents',
                                            verbose_name='Child')

            class Meta(core.Model.Meta):
                attribute_order = ('id', 'name', 'child')
                verbose_name = 'Parent'
                verbose_name_plural = 'Parent'
コード例 #9
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
 class DisjointParent(core.Model):
     id = core.StringAttribute(primary=True, unique=True)
コード例 #10
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
class Leaf(core.Model):
    id = core.StringAttribute(primary=True)
    node = core.ManyToOneAttribute(Node, related_name='leaves')
コード例 #11
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
class Node(core.Model):
    id = core.StringAttribute(max_length=2, primary=True, unique=True)
    root = core.ManyToOneAttribute(Root, related_name='nodes')
コード例 #12
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
 class NormNodeLevel2(core.Model):
     label = core.StringAttribute(primary=True, unique=True)
     parents = core.ManyToManyAttribute(NormNodeLevel1,
                                        related_name='children')
コード例 #13
0
 class Model(core.Model):
     id = core.StringAttribute()
コード例 #14
0
 class Parent(core.Model):
     id = core.SlugAttribute()
     name = core.StringAttribute()
コード例 #15
0
 class TestModel(core.Model):
     registry = pint.UnitRegistry()
     str_attr = core.StringAttribute()
     unit_attr_1 = units.UnitAttribute(registry)
     unit_attr_2 = units.UnitAttribute(registry)
コード例 #16
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
class Root(core.Model):
    id = core.StringAttribute(max_length=1,
                              primary=True,
                              unique=True,
                              verbose_name='Identifier')
コード例 #17
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
 class Test(core.Model):
     val = core.StringAttribute()
コード例 #18
0
 class Child(core.Model):
     id = core.SlugAttribute()
     name = core.StringAttribute()
     parents = core.ManyToManyAttribute(Parent, related_name='children')
コード例 #19
0
ファイル: test_utils.py プロジェクト: 0u812/obj_tables
 class NormNodeLevel0(core.Model):
     label = core.StringAttribute(primary=True, unique=True)
コード例 #20
0
        class Model(core.Model):
            attr_1 = core.StringAttribute()
            attr_2 = core.StringAttribute()

            class Meta(core.Model.Meta):
                merge = core.ModelMerge.join
コード例 #21
0
ファイル: test_grammar.py プロジェクト: 0u812/obj_tables
        class NoPrimary(core.Model):
            name = core.StringAttribute()

            def serialize(self):
                return self.name