haldis/app/views/stats.py

22 lines
602 B
Python
Raw Normal View History

from flask import Blueprint
from flask import current_app as app
2016-09-10 15:49:52 +02:00
from flask import render_template
from fatmodels import FatLocation, FatOrder, FatOrderItem, FatProduct, FatUser
2016-09-10 16:52:46 +02:00
stats_blueprint = Blueprint('stats_blueprint', __name__)
2016-09-10 15:49:52 +02:00
@stats_blueprint.route('/')
2016-09-10 15:49:52 +02:00
def stats():
2016-09-10 16:52:46 +02:00
data = {
2016-09-10 23:01:13 +02:00
'amount': {
'orders': FatOrder.amount(),
'locations': FatLocation.amount(),
'users': FatUser.amount(),
'orderitems': FatOrderItem.amount(),
'products': FatProduct.amount(),
}
2016-09-10 16:52:46 +02:00
}
return render_template('stats.html', data=data)