from app import app
from flask import request, render_template
from app.models import Data
from app import db

@app.route("/",methods=["GET","POST"])
def index():
    if request.method=="POST":
        print "got here"
        data = request.form.get("data")
        d = Data(data)
        db.session.add(d)
        db.session.commit()
        return render_template("index.html",entered_data=data)
    return render_template("index.html")

@app.route("/show_data",methods=["GET"])
def show_data():
    return render_template("show_data.html",data=Data.query.all())

