當前位置: 首頁>>代碼示例>>Python>>正文


Python Extension.deleted方法代碼示例

本文整理匯總了Python中mkt.extensions.models.Extension.deleted方法的典型用法代碼示例。如果您正苦於以下問題:Python Extension.deleted方法的具體用法?Python Extension.deleted怎麽用?Python Extension.deleted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mkt.extensions.models.Extension的用法示例。


在下文中一共展示了Extension.deleted方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: fake_object

# 需要導入模塊: from mkt.extensions.models import Extension [as 別名]
# 或者: from mkt.extensions.models.Extension import deleted [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


注:本文中的mkt.extensions.models.Extension.deleted方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。