Ejemplo n.º 1
0
 def get_content_ratings(self, obj):
     body = mkt.regions.REGION_TO_RATINGS_BODY().get(self.context["request"].REGION.slug, "generic")
     return {
         "body": body,
         "rating": dehydrate_content_rating((obj.es_data.get("content_ratings") or {}).get(body)) or None,
         "descriptors": dehydrate_descriptors(obj.es_data.get("content_descriptors", {})).get(body, []),
         "interactives": dehydrate_interactives(obj.es_data.get("interactive_elements", [])),
     }
Ejemplo n.º 2
0
 def get_content_ratings(self, obj):
     return filter_content_ratings_by_region({
         'ratings': dehydrate_content_ratings(
             obj.es_data.get('content_ratings', {})),
         'descriptors': dehydrate_descriptors(
             obj.es_data.get('content_descriptors', {})),
         'interactive_elements': dehydrate_interactives(
             obj.es_data.get('interactive_elements', [])),
         'regions': mkt.regions.REGION_TO_RATINGS_BODY()
     }, region=self.context['request'].REGION.slug)
Ejemplo n.º 3
0
 def get_content_ratings(self, obj):
     body = (mkt.regions.REGION_TO_RATINGS_BODY().get(
         self.context['request'].REGION.slug, 'generic'))
     return {
         'body': body,
         'rating': dehydrate_content_rating(
             (obj.es_data.get('content_ratings') or {})
             .get(body)) or None,
         'descriptors': dehydrate_descriptors(
             obj.es_data.get('content_descriptors', {})
         ).get(body, []),
         'interactives': dehydrate_interactives(
             obj.es_data.get('interactive_elements', [])),
     }
Ejemplo n.º 4
0
 def get_content_ratings(self, obj):
     body = (mkt.regions.REGION_TO_RATINGS_BODY().get(
         self.context['request'].REGION.slug, 'generic'))
     return {
         'body': body,
         'rating': dehydrate_content_rating(
             (obj.es_data.get('content_ratings') or {})
             .get(body)) or None,
         'descriptors': dehydrate_descriptors(
             obj.es_data.get('content_descriptors', {})
         ).get(body, []),
         'interactives': dehydrate_interactives(
             obj.es_data.get('interactive_elements', [])),
     }
Ejemplo n.º 5
0
 def get_content_ratings(self, obj):
     return filter_content_ratings_by_region(
         {
             'ratings':
             dehydrate_content_ratings(
                 obj.es_data.get('content_ratings', {})),
             'descriptors':
             dehydrate_descriptors(
                 obj.es_data.get('content_descriptors', {})),
             'interactive_elements':
             dehydrate_interactives(
                 obj.es_data.get('interactive_elements', [])),
             'regions':
             mkt.regions.REGION_TO_RATINGS_BODY()
         },
         region=self.context['request'].REGION.slug)