本文整理汇总了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