本文整理汇总了Python中addons.models.Addon.transformer方法的典型用法代码示例。如果您正苦于以下问题:Python Addon.transformer方法的具体用法?Python Addon.transformer怎么用?Python Addon.transformer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类addons.models.Addon
的用法示例。
在下文中一共展示了Addon.transformer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: transformer
# 需要导入模块: from addons.models import Addon [as 别名]
# 或者: from addons.models.Addon import transformer [as 别名]
def transformer(apps):
# I think we can do less than the Addon transformer, so at some point
# we'll want to copy that over.
apps_dict = Addon.transformer(apps)
if not apps_dict:
return
for adt in AddonDeviceType.objects.filter(addon__in=apps_dict):
if not getattr(apps_dict[adt.addon_id], '_device_types', None):
apps_dict[adt.addon_id]._device_types = []
apps_dict[adt.addon_id]._device_types.append(adt.device_type)
示例2: transformer
# 需要导入模块: from addons.models import Addon [as 别名]
# 或者: from addons.models.Addon import transformer [as 别名]
def transformer(apps):
# I think we can do less than the Addon transformer, so at some point
# we'll want to copy that over.
apps_dict = Addon.transformer(apps)
if not apps_dict:
return
for adt in AddonDeviceType.objects.filter(addon__in=apps_dict):
if not getattr(apps_dict[adt.addon_id], '_device_types', None):
apps_dict[adt.addon_id]._device_types = []
apps_dict[adt.addon_id]._device_types.append(adt.device_type)
# TODO: This may need to be its own column.
for app in apps:
if not hasattr(app, '_rating_counts') and hasattr(app, '_ratings'):
app._rating_counts = app.rating_counts