コード例 #1
0
 def get_media(self, obj):
     return MediaEntitiesSerializer(obj.get_media_filter(
         type=MediaEntities.TYPE_IMAGE,
         sub_type=[
             MediaEntities.SUB_TYPE_BANNER, MediaEntities.SUB_TYPE_LOGO
         ]),
                                    many=True).data
コード例 #2
0
 def get_media(self, obj):
     return MediaEntitiesSerializer(obj.get_media_filter(
         type=MediaEntities.TYPE_IMAGE,
         sub_type=MediaEntities.SUB_TYPE_SPONSORS_LOGO),
                                    many=True).data
コード例 #3
0
 def get_media(self, obj):
     mobjs = obj.media.all().generic_objects()
     data = MediaEntitiesSerializer(mobjs, many=True).data
     return data
コード例 #4
0
 def get_media(self, obj):
     return MediaEntitiesSerializer(obj.get_sub_entities_of_type(
         BaseEntity.SUB_ENTITY_MEDIA),
                                    many=True,
                                    context=self.context).data