def show(username): if not current_user.is_authenticated: flash("You are not logged in", "info") return redirect(url_for('sessions.new')) else: user = User.get(User.username == username) approved = FanIdol.get_or_none(FanIdol.fan == current_user.id, FanIdol.idol == user.id, FanIdol.approved == True) return render_template('users/show.html', user=user, approved=approved)
def approve(self, fan): from models.fan_idol import FanIdol relationship = FanIdol.get_or_none(idol = self.id, fan=fan.id) relationship.is_approved = True return relationship.save()
def show(username): user = User.get(User.username == username) images = Image.select(Image, User).join(User).where(Image.user_id == user.id) idol = FanIdol.get_or_none(FanIdol.idol == user.id, FanIdol.fan == current_user.id) return render_template('users/show.html',name=user.name, user = user, images = images, idol = idol)
def follow_status(self,idol): from models.fan_idol import FanIdol return FanIdol.get_or_none(fan=self.id,idol=idol.id)