def follow(self, idol): from models.fan_idol import FanIdol if self.follow_status(idol) == None: new_relationship = FanIdol(fan=self.id, idol=idol.id) if idol.is_private == False: new_relationship.is_approved = True return new_relationship.save() else: return 0
def follow(self, idol): from models.fan_idol import FanIdol # check whether current user follow idol before # relationship = FanIdol.get_or_none(fan=self.id, idol=idol.id) if self.follow_status(idol) == None: new_rel = FanIdol(fan=self.id, idol=idol.id) if idol.is_private == False: # public idol new_rel.is_approved = True return new_rel.save() else: return 0
def follow(self,idol): #check existing relationship in fanidol table from models.fan_idol import FanIdol # relationship = FanIdol.get_or_none(fan=self.id, idol = idol.id) if self.follow_status(idol) == None: new_rel = FanIdol(fan=self.id, idol = idol.id) if idol.is_private == False: #public idol new_rel.is_approved = True return new_rel.save() else: return 0