def user(username): user = User.query.filter_by(username=username).first() if user is None: abort(404) posts=user.posts timelineViews = PostView.toTimelineView(*posts) return render_template('user.html', user=user,timelines=timelineViews)
def index(): if current_user.is_authenticated(): posts = current_user.followed_posts timelineViews = PostView.toTimelineView(*posts) return render_template('timeline.html', timelines=timelineViews) else: return redirect(url_for('.explore'))
def explore(): posts = Post.query.order_by(Post.timestamp.desc()).limit(20) return render_template('explore.html',posts=PostView.toTimelineView(*posts))