def approved(id): fan = User.get_by_id(id) follower = FanIdol.update(approved=True).where(FanIdol.fan==id,FanIdol.idol==current_user.id) if follower.execute(): flash(f'{fan.username} now is your follower.','primary') return redirect(url_for('users.show',username=current_user.username)) else: flash(f'Failed to approve request,try again later.','danger') return redirect(url_for('users.show',username=current_user.username))
def approve_request(self,fan): from models.fanidol import FanIdol return FanIdol.update(approved=True).where(FanIdol.fan==fan.id,FanIdol.idol==self.id).execute()