Small reformat

This commit is contained in:
Wout Schellaert 2016-09-10 15:49:52 +02:00
parent 38843173d5
commit 7ca0e36946
3 changed files with 22 additions and 15 deletions

View file

@ -1,20 +1,23 @@
__author__ = 'feliciaan'
from flask import url_for, render_template, abort, redirect, request, abort
from flask.ext.login import current_user, login_required
from datetime import datetime, timedelta
from app import app, db
from models import Order, OrderItem, Location
from flask import url_for, render_template, abort
from flask.ext.login import login_required
from app import app
from models import Order, Location
# import views
from views.order import get_orders
from views import stats
@app.route('/')
def home():
prev_day = datetime.now() - timedelta(days=1)
recently_closed = get_orders(((Order.stoptime > prev_day) & (Order.stoptime < datetime.now())))
return render_template('home.html', orders=get_orders(), recently_closed=recently_closed)
recently_closed = get_orders(
((Order.stoptime > prev_day) & (Order.stoptime < datetime.now())))
return render_template('home.html', orders=get_orders(),
recently_closed=recently_closed)
@app.route('/location')
@ -25,20 +28,17 @@ def locations():
@app.route('/location/<int:id>')
def location(id):
loc = Location.query.filter(Location.id==id).first()
loc = Location.query.filter(Location.id == id).first()
if loc is None:
abort(404)
return render_template('location.html', location=loc)
@app.route('/about/')
def about():
return render_template('about.html')
return render_template('about.html')
@app.route('/stats/')
def stats():
return render_template('stats.html')
@app.route('/profile/')
@login_required
def profile():

7
app/views/stats.py Normal file
View file

@ -0,0 +1,7 @@
from app import app
from flask import render_template
@app.route('/stats/')
def stats():
return render_template('stats.html')