Пример #1
0
class ImageAsset(Model, TestModelMixin):
    default_fields = [
        'topics', 'attributes.imageFormat', 'attributes.imageType'
    ]

    title = StringProperty()
    version = StringProperty(default='1')
    description = StringProperty()
    name = StringProperty()
    skills = StringProperty(repeated=True)

    topics = KeyProperty(kind=Tag, repeated=True)

    publicationDate = AttributesProperty(
        attributes={'year': IntegerProperty()})

    attributes = AttributesProperty(
        attributes={
            'imageFormat':
            KeyProperty(kind=Tag, repeated=True),
            'imageType':
            KeyProperty(kind=Tag, repeated=True),
            'files':
            AttributesProperty(attributes={
                'url': StringProperty(),
                'bucket_key': StringProperty(),
                'mime_type': StringProperty(),
                'height': IntegerProperty(),
                'width': IntegerProperty()
            },
                               repeated=True)
        })
class Edge(Model, CassandraModelMixin):
    _storage_type = ('simple',)

    label = StringProperty()
    indoc = KeyProperty()
    outdoc = KeyProperty()
    create_date = DateTimeProperty(auto_now_add=True)
    last_update = DateTimeProperty(auto_now=True)
Пример #3
0
class VideoAsset(Model, CassandraModelMixin):
    title = StringProperty(default='monkey')
    music = 'rock'
    num = IntegerProperty()

    def _pre_put_hook(self):
        self.music = 'metal'

    @key_ref
    def revision(self):
        if hasattr(self, 'version'):
            return self.version
        return '1'
Пример #4
0
class Tag(Model, TestModelMixin):
    title = StringProperty()
Пример #5
0
 class Article(Model, TestModelMixin):
     revision = IntegerProperty(default=1)
     title = StringProperty()
Пример #6
0
class Book(Model, TestModelMixin):
    title = StringProperty()
    published = DateTimeProperty(auto_now_add=True)
    updated = DateTimeProperty(auto_now=True)
Пример #7
0
 class AudioAsset(Model):
     titles = StringProperty(repeated=True)
Пример #8
0
class ImageAsset(Model):
    title = StringProperty()
    description = StringProperty()