Beispiel #1
0
 def _format_product_to_show(self, p, only_show_first_photo=False):
     p.country = Country.get_display(p.country)
     p.brand = Brand.get_display(p.brand)
     p.region = Region.get_display(p.region)
     p.grape_sort = GrapeSort.get_display(p.grape_sort)
     p.sort = WineSort.get_display(p.sort)
     p.wine_level = WineLevel.get_display(p.wine_level)
     dp = m2d(p)
     if only_show_first_photo:
         # just show first photo
         img = p.photos.where(ProductPhoto.seq_num == 1)[0]
         dp["img_url"] = img.hash_value + "." + img.photo_type
     else:
         img = p.photos
         dp["img_url"] = [i.hash_value + "." + i.photo_type for i in img]
     scenes = p.scenes
     labels = p.labels
     dp["scenes"] = [Scene.get_display(i.scene) for i in scenes]
     dp["labels"] = [ProductLabel.get_display(i.label) for i in labels]
     return dp
Beispiel #2
0
 def _get_poster_by_place(self, place):
     rs = Poster.select().where(Poster.place == place)
     return m2d(rs)
Beispiel #3
0
 def _func(*args, **kwargs):
     a = f(*args, **kwargs)
     return m2d(a)