Ejemplo n.º 1
0
def portfolio():
    mysession()

    selectedID = request.args.get('id')
    alpha = get_alpha(selectedID)

    return render_template('Extend_portfolio.html', alphas=alpha)
Ejemplo n.º 2
0
def show_comment():
    mysession()
    conn = conn_db()
    cur = conn.cursor()
    cur.execute(
        """SELECT sys_table.username, post.comment_id, post.created, post.comment 
               FROM sys_table, post WHERE sys_table.userid = post.author_id""")
    posts = cur.fetchall()
    cur.close()
    conn.commit()
    conn.close()

    return render_template('blog/comment_order.html', posts=posts)
Ejemplo n.º 3
0
def update(id):
    if mysession():
        post = get_post(id)
        if request.method == 'POST':
            body = request.form['comment']
            error = None

            if not body:
                error = 'comment can not be empty!'
            if error is not None:
                flash(error)
                return redirect(url_for('show_comment'))
            else:

                conn = conn_db()
                cur = conn.cursor()
                cur.execute(
                    'UPDATE post SET  comment = %s'
                    'WHERE comment_id = %s', (body, id))
                cur.close()
                conn.commit()
                conn.close()
                return redirect(url_for('show_comment'))
        else:
            return render_template('blog/update.html', post=post)
    else:
        error = 'Only logged users can insert posts!'
        flash(error)
        return redirect(url_for('login'))
Ejemplo n.º 4
0
def comment():
    if mysession():
        if request.method == 'POST':
            body = request.form['comment']
            error = None

            if not body:
                error = 'comment can not be empty'
            if error is not None:
                flash(error)
                return redirect(url_for('show_comment'))
            else:
                conn = conn_db()
                cur = conn.cursor()
                cur.execute(
                    'INSERT INTO post (comment, author_id) VALUES ( %s, %s)',
                    (body, g.user[0]))
                cur.close()
                conn.commit()
                conn.close()
                return redirect(url_for('show_comment'))
        else:
            return render_template('Extend.html')
    else:
        error = 'You must be logged in to comment!'
        flash(error)
        return redirect(url_for('login'))
Ejemplo n.º 5
0
def contact():
    mysession()
    return render_template('contact.html')
Ejemplo n.º 6
0
def About():
    if mysession():
        return render_template('About.html')
    return render_template('About.html')
Ejemplo n.º 7
0
def HomeWithMap():

    mysession()
    make_plot()
    return render_template('Map_home.html')