当前位置: 首页>>代码示例>>Python>>正文


Python Extension.es_data方法代码示例

本文整理汇总了Python中mkt.extensions.models.Extension.es_data方法的典型用法代码示例。如果您正苦于以下问题:Python Extension.es_data方法的具体用法?Python Extension.es_data怎么用?Python Extension.es_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mkt.extensions.models.Extension的用法示例。


在下文中一共展示了Extension.es_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fake_object

# 需要导入模块: from mkt.extensions.models import Extension [as 别名]
# 或者: from mkt.extensions.models.Extension import es_data [as 别名]
    def fake_object(self, data):
        """Create a fake instance of Extension from ES data."""
        obj = Extension(id=data['id'])

        # Create a fake ExtensionVersion for latest_public_version.
        if data['latest_public_version']:
            obj.latest_public_version = ExtensionVersion(
                extension=obj,
                id=data['latest_public_version']['id'],
                created=data['latest_public_version']['created'],
                size=data['latest_public_version'].get('size', 0),
                status=STATUS_PUBLIC,
                version=data['latest_public_version']['version'],)

        # Set basic attributes we'll need on the fake instance using the data
        # from ES.
        self._attach_fields(
            obj, data, ('author', 'created', 'default_language',
                        'last_updated', 'modified', 'slug', 'status',
                        'version'))

        obj.deleted = data['is_deleted']
        obj.disabled = data['is_disabled']
        obj.uuid = data['guid']

        # Attach translations for all translated attributes.
        # obj.default_language should be set first for this to work.
        self._attach_translations(
            obj, data, ('name', 'description', ))

        # Some methods might need the raw data from ES, put it on obj.
        obj.es_data = data

        return obj
开发者ID:elysium001,项目名称:zamboni,代码行数:36,代码来源:serializers.py

示例2: fake_object

# 需要导入模块: from mkt.extensions.models import Extension [as 别名]
# 或者: from mkt.extensions.models.Extension import es_data [as 别名]
    def fake_object(self, data):
        """Create a fake instance of Extension from ES data."""
        obj = Extension(id=data["id"])

        # Create a fake ExtensionVersion for latest_public_version.
        obj.latest_public_version = ExtensionVersion(
            extension=obj,
            pk=data["latest_public_version"]["id"],
            status=STATUS_PUBLIC,
            version=data["latest_public_version"]["version"],
        )

        # Set basic attributes we'll need on the fake instance using the data
        # from ES.
        self._attach_fields(obj, data, ("default_language", "slug", "status", "version"))

        obj.uuid = data["guid"]

        # Attach translations for all translated attributes.
        # obj.default_language should be set first for this to work.
        self._attach_translations(obj, data, ("name", "description"))

        # Some methods might need the raw data from ES, put it on obj.
        obj.es_data = data

        return obj
开发者ID:demagu-sr,项目名称:zamboni,代码行数:28,代码来源:serializers.py

示例3: fake_object

# 需要导入模块: from mkt.extensions.models import Extension [as 别名]
# 或者: from mkt.extensions.models.Extension import es_data [as 别名]
    def fake_object(self, data):
        """Create a fake instance of Extension from ES data."""
        obj = Extension(id=data['id'])

        # Set basic attributes we'll need on the fake instance using the data
        # from ES.
        self._attach_fields(
            obj, data, ('default_language', 'slug', 'status', 'version'))

        obj.uuid = data['guid']

        # Attach translations for all translated attributes.
        # obj.default_language should be set first for this to work.
        self._attach_translations(
            obj, data, ('name', ))

        # Some methods might need the raw data from ES, put it on obj.
        obj.es_data = data

        return obj
开发者ID:tsl143,项目名称:zamboni,代码行数:22,代码来源:serializers.py


注:本文中的mkt.extensions.models.Extension.es_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。