Пример #1
0
class ChangedTest(Model):  # Model Test renamed to ChangedTest
    id = SlugAttribute()
    name = StringAttribute(default='test')
    # Attribute Test.existing_attr renamed to ChangedTest.migrated_attr
    migrated_attr = StringAttribute()
    # Attribute ChangedTest.revision added
    revision = StringAttribute(default='0.0')
    # Type of attribute Test.size changed to an integer
    size = IntegerAttribute()
Пример #2
0
class Test(obj_tables.Model):
    id = SlugAttribute()
    name = StringAttribute(default='test')
    revision = StringAttribute(default='0.0')
    existing_attr = StringAttribute(default='existing_attr_val')
    references = ManyToManyAttribute('Reference', related_name='tests')

    class Meta(obj_tables.Model.Meta):
        attribute_order = ('id', 'name', 'revision', 'existing_attr')
        table_format = TableFormat.column
Пример #3
0
class Test(obj_tables.Model):
    """ Test

    Related attributes:
        property (:obj:`Property`): property
        subtests (:obj:`list` of `Subtest`): subtests
    """
    id = SlugAttribute()
    name = StringAttribute(default='test')
    version = RegexAttribute(min_length=1, pattern=r'^[0-9]+\.[0-9+]\.[0-9]+', flags=re.I)
    revision = StringAttribute(default='0.0')
    existing_attr = StringAttribute(default='existing_attr_val')

    class Meta(obj_tables.Model.Meta):
        attribute_order = ('id', 'name', 'version', 'revision', 'existing_attr')
        table_format = TableFormat.column
class Test(obj_tables.Model):
    id = SlugAttribute()
    name = StringAttribute(default='test')
    existing_attr = IntegerAttribute(default=3)
    references = ManyToManyAttribute('Reference', related_name='tests')

    class Meta(obj_tables.Model.Meta):
        attribute_order = ('id', 'name', 'existing_attr')
Пример #5
0
class Reference(obj_tables.Model):
    """ Reference

    Related attributes:
        subtests (:obj:`list` of `Subtest`): subtests
    """
    id = SlugAttribute()
    value = StringAttribute()

    class Meta(obj_tables.Model.Meta):
        attribute_order = ('id', 'value')
Пример #6
0
class Reference(Model):
    """ Another definition of Reference, which causes a _check_imported_models error

    Related attributes:
        subtests (:obj:`list` of `Subtest`): subtests
    """
    id = SlugAttribute()
    value = StringAttribute()

    class Meta(Model.Meta):
        attribute_order = ('id', 'value')
Пример #7
0
class Test(Model):
    """ Test

    Related attributes:
        subtests (:obj:`list` of `Subtest`): subtests
    """
    id = SlugAttribute()
    name = StringAttribute(default='my name')
    references = ManyToManyAttribute(Reference, related_name='tests')

    class Meta(Model.Meta):
        attribute_order = ('id', 'name', 'references')
        table_format = TableFormat.column
Пример #8
0
class Reference(Model):
    id = SlugAttribute()
    value = StringAttribute()
Пример #9
0
class Reference(obj_tables.Model):
    id = SlugAttribute()
    value = StringAttribute()

    class Meta(obj_tables.Model.Meta):
        attribute_order = ('id', 'value')
Пример #10
0
class Test(Model):
    id = SlugAttribute()
    name = StringAttribute(default='test')
    existing_attr = StringAttribute()
    size = FloatAttribute()
    color = StringAttribute()