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


Python Website.devices方法代码示例

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


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

示例1: fake_object

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

        # Set basic attributes on the fake instance using the data from ES.
        self._attach_fields(obj, data, ("default_locale", "icon_hash", "mobile_url", "promo_img_hash", "tv_url", "url"))

        # Set attributes with names that don't exactly match the one on the
        # model.
        obj.categories = data["category"]
        obj.devices = data["device"]
        obj.keywords_list = data["tags"]

        if obj.icon_hash:
            # If we have an icon_hash, then we have an icon. All the icons we
            # store are PNGs.
            obj.icon_type = "image/png"

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

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

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

示例2: fake_object

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

        # Set basic attributes on the fake instance using the data from ES.
        self._attach_fields(obj, data, ('default_locale', 'icon_hash', 'url'))

        # Set attributes with names that don't exactly match the one on the
        # model.
        obj.categories = data['category']
        obj.devices = data['device']

        if obj.icon_hash:
            # If we have an icon_hash, then we have an icon. All the icons we
            # store are PNGs.
            obj.icon_type = 'image/png'

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

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

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

示例3: fake_object

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

        # Set base attributes on the fake instance using the data from ES.
        self._attach_fields(obj, data, ('default_locale',))

        # Set attributes with names that don't exactly match the one on the
        # model.
        obj.categories = data['category']
        obj.devices = data['device']

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

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

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


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