Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
def index():
    posts = get_todays_recent_posts()
    return render_template('index.html', posts=posts)
Esempio n. 4
0
def index():
    posts = get_todays_recent_posts()
    return render_template('index.html', posts=posts)