示例#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()