Ejemplo n.º 1
0
 def fans(self):
     # return a list of fan user instances that only approved
     from models.fan_idol import FanIdol
     fans_id = FanIdol.select(FanIdol.fan).where(
         FanIdol.idol == self.id, FanIdol.is_approved == True)
     fans = User.select().where(User.id.in_(fans_id))
     return fans
Ejemplo n.º 2
0
 def idols(self):
     # return a list of idol user instances that only approved
     from models.fan_idol import FanIdol
     idols_id = FanIdol.select(FanIdol.idol).where(
         FanIdol.fan == self.id, FanIdol.is_approved == True)
     idols = User.select().where(User.id.in_(idols_id))
     return idols
Ejemplo n.º 3
0
 def image_feed(self):
     from models.fan_idol import FanIdol
     from models.image import Image
     approved_idols_id = FanIdol.select(FanIdol.idol).where(
         FanIdol.fan == self.id, FanIdol.is_approved == True)
     return Image.select().where(
         Image.user.in_(approved_idols_id)).order_by(
             Image.created_at.desc())
Ejemplo n.º 4
0
 def image_feed(self):
     from models.fan_idol import FanIdol
     from models.image import Image
     approved_idols_id = FanIdol.select(FanIdol.idol).where(
         FanIdol.fan == self.id, FanIdol.is_approved == True)
     idols_with_me = [x.idol for x in approved_idols_id
                      ]  # return a list of idols' id
     idols_with_me.append(self.id)  # add your own id
     return Image.select().where(Image.user.in_(idols_with_me)).order_by(
         Image.created_at.desc())
 def fan_requests(self):
     from models.fan_idol import FanIdol
     fans_id = FanIdol.select(FanIdol.fan).where(FanIdol.idol== self.id, FanIdol.is_approved==False)
     return User.select().where(User.id.in_(fans_id))
Ejemplo n.º 6
0
 def fans(self):
     from models.fan_idol import FanIdol
     fans_id = FanIdol.select(FanIdol.fan).where(
         FanIdol.idol == self.id, FanIdol.is_approved == True)
     fans = User.select().where(User.id.in_(fans_id))
     return fans
Ejemplo n.º 7
0
 def idols(self):
     from models.fan_idol import FanIdol
     idols_id = FanIdol.select(FanIdol.idol).where(
         FanIdol.fan == self.id, FanIdol.is_approved == True)
     idols = User.select().where(User.id.in_(idols_id))
     return idols
Ejemplo n.º 8
0
 def idol_requests(self):
     from models.fan_idol import FanIdol
     idols_id = FanIdol.select(FanIdol.idol).where(
         FanIdol.fan == self.id, FanIdol.is_approved == False)
     return User.select().where(User.id.in_(idols_id)).order_by(
         User.created_at.desc())