コード例 #1
0
 def get_slideshow_images(self, obj):
     images = Image.active.get_images_for_news(obj.id)
     if images:
         final_images = ImageSerializer(instance=images,
                                        user=self.user,
                                        token=self.auth_token,
                                        many=True)
         final_images.include_fields(
             ('id', 'title', 'description', 'url', 'image', 'auth_token',
              'data_content_type'))
         return final_images.data
     else:
         return None
コード例 #2
0
 def get_slideshow_images(self, obj):
     images = None
     if hasattr(obj, "gallery_id") and obj.gallery_id is not None:
         if hasattr(self, "host_det") and self.host_det == "app":
             images = Image.active.filter(
                 gallery=obj.gallery,
                 parent_id__isnull=True).order_by('sequence')
     else:
         images = Image.active.get_images_for_news(obj.id)
     if images:
         final_images = ImageSerializer(instance=images,
                                        user=self.user,
                                        token=self.auth_token,
                                        many=True,
                                        image_type=self.image_type)
         final_images.include_fields(('id', 'title', 'description', 'image',
                                      'thumb', 'source', 'source_url'))
         return final_images.data
     else:
         return None