def login(): error = None if request.method == 'POST': value = db.authenticate(request.form['username'], request.form['password']) if (value == 1): print "login Succesfully" session['name'] = request.form['username'] user_data = session['name'] print user_data data = db.filter_user_data(user_data) print type(data), data, len(data) data_user_get = db.filter_user_chart(user_data) graph_data = [] for elem in data_user_get: cat = elem[0] exp = elem[1] li = [cat, int(exp)] graph_data.append(li) graph_data.insert(0, ['Category', 'Expenses']) print "Graph data ", graph_data return render_template('index.html', error=error, data=data, data_chart=graph_data) else: error = 'Invalid username or password \ Please try again!' return render_template('login.html', error=error, session=session) return render_template('login.html')
def catagory(): error = None if 'name' in session: data_catagory = db.catagory_alreadyexits(session['name'], request.form['field7'], request.form['field8'], request.form['field9']) if (data_catagory == 1): flash( 'ERROR! CATAGORY ALREADY SATISFIED OR SOMETHING WENT WRONG PLEASE CHECK NEXT MESSAGE TO CONFIRM' ) else: flash(data_catagory) user_data = session['name'] print user_data data = db.filter_user_data(user_data) print type(data), data, len(data) data_user_get = db.filter_user_chart(user_data) graph_data = [] for elem in data_user_get: cat = elem[0] exp = elem[1] li = [cat, int(exp)] graph_data.append(li) graph_data.insert(0, ['Category', 'Expenses']) print "Graph data ", graph_data return render_template('index.html', error=error, data=data, data_chart=graph_data) flash('REQUEST PERFORMED!') return redirect(url_for('add')) else: flash('Please Login to Perform Action') return redirect(url_for('logina'))
def login(): error = None if request.method == 'POST': value = db.authenticate( request.form['username'], request.form['password']) if (value == 1): print ("Succesful") session['name'] = request.form['username'] user_data = session['name'] print (user_data) data = db.filter_user_data(user_data) print (type(data), data, len(data)) data_user_get = db.filter_user_chart(user_data) graph_data = [] for elem in data_user_get: cat = elem[0] exp = elem[1] li = [cat, int(exp)] graph_data.append(li) graph_data.insert(0, ['Category', 'Expenses']) print ("Graph data ", graph_data) return render_template( 'index.html', error=error, data=data, data_chart=graph_data) else: error = 'Invalid username or password \ Please try again!' return render_template('login.html', error=error, session=session) return render_template('login.html')
def category(): error = None data_category = db.category_alreadyexits(session['name'], request.form['field7'], request.form['field8'], request.form['field9']) if (data_category == 1): flash('CATEGORY ALREADY PRESENT/INVALID INPUT') else: flash(data_category) user_data = session['name'] print (user_data) data = db.filter_user_data(user_data) print (type(data), data, len(data)) data_user_get = db.filter_user_chart(user_data) graph_data = [] for elem in data_user_get: cat = elem[0] exp = elem[1] li = [cat, int(exp)] graph_data.append(li) graph_data.insert(0, ['Category', 'Expenses']) print ("Graph data ", graph_data) return render_template( 'index.html', error=error, data=data, data_chart=graph_data) flash('REQUEST PERFORMED!') return redirect('add')
def index(): error = None user_data = session['name'] print user_data data = db.filter_user_data(user_data) print type(data), data, len(data) data_user_get = db.filter_user_chart(user_data) graph_data = [] for elem in data_user_get: cat = elem[0] exp = elem[1] li = [cat, int(exp)] graph_data.append(li) graph_data.insert(0, ['Category', 'Expenses']) print "Graph data ", graph_data return render_template('index.html', error=error, data=data, data_chart=graph_data, session=session)
def index(): error = None user_data = session['name'] print (user_data) data = db.filter_user_data(user_data) print (type(data), data, len(data)) data_user_get = db.filter_user_chart(user_data) graph_data = [] for elem in data_user_get: cat = elem[0] exp = elem[1] li = [cat, int(exp)] graph_data.append(li) graph_data.insert(0, ['Category', 'Expenses']) print ("Graph data ", graph_data) return render_template( 'index.html', error=error, data=data, data_chart=graph_data, session=session)