Example #1
0
        class Parent(core.Model):
            id = core.SlugAttribute()
            name = core.StringAttribute()

            class Meta(core.Model.Meta):
                attribute_order = ('id', 'name')
                table_format = core.TableFormat.column
Example #2
0
        class Parent(core.Model):
            id = core.SlugAttribute()
            name = core.StringAttribute()
            age = core.IntegerAttribute()

            class Meta(core.Model.Meta):
                table_format = core.TableFormat.cell
Example #3
0
        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')
Example #4
0
        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'
Example #5
0
        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'
Example #6
0
        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)
Example #7
0
        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')
Example #8
0
        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'
Example #9
0
 class DisjointParent(core.Model):
     id = core.StringAttribute(primary=True, unique=True)
Example #10
0
class Leaf(core.Model):
    id = core.StringAttribute(primary=True)
    node = core.ManyToOneAttribute(Node, related_name='leaves')
Example #11
0
class Node(core.Model):
    id = core.StringAttribute(max_length=2, primary=True, unique=True)
    root = core.ManyToOneAttribute(Root, related_name='nodes')
Example #12
0
 class NormNodeLevel2(core.Model):
     label = core.StringAttribute(primary=True, unique=True)
     parents = core.ManyToManyAttribute(NormNodeLevel1,
                                        related_name='children')
Example #13
0
 class Model(core.Model):
     id = core.StringAttribute()
Example #14
0
 class Parent(core.Model):
     id = core.SlugAttribute()
     name = core.StringAttribute()
Example #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)
Example #16
0
class Root(core.Model):
    id = core.StringAttribute(max_length=1,
                              primary=True,
                              unique=True,
                              verbose_name='Identifier')
Example #17
0
 class Test(core.Model):
     val = core.StringAttribute()
Example #18
0
 class Child(core.Model):
     id = core.SlugAttribute()
     name = core.StringAttribute()
     parents = core.ManyToManyAttribute(Parent, related_name='children')
Example #19
0
 class NormNodeLevel0(core.Model):
     label = core.StringAttribute(primary=True, unique=True)
Example #20
0
        class Model(core.Model):
            attr_1 = core.StringAttribute()
            attr_2 = core.StringAttribute()

            class Meta(core.Model.Meta):
                merge = core.ModelMerge.join
Example #21
0
        class NoPrimary(core.Model):
            name = core.StringAttribute()

            def serialize(self):
                return self.name