def add_post(): title = request.form['title'] text = request.form['text'] if not title: flash('You must give your post a title.') elif not text: flash('You must give your post a text body.') else: username = session['username'] User(username, None, None, None, None, None).add_post(title, text) posts = get_todays_recent_posts() return render_template('dashboard.html', posts=posts)
def login(): if request.method == 'POST': username = request.form['username'] password = request.form['password'] if not User.verify_exists(username, password): flash('Invalid login.') return render_template('index.html') else: session['username'] = username flash('Logged in.') posts = get_todays_recent_posts() assignments = get_student_assignments(session['username']) courses = get_student_course(session['username']) return render_template('dashboard.html', posts=posts, assignments=assignments, courses=courses)
def index(): posts = get_todays_recent_posts() return render_template('index.html', posts=posts)