def index(self): query = User.query.with_entities(db.extract('year', User.firstUse), db.extract('month', User.firstUse), db.func.count()). \ group_by(db.extract('year', User.firstUse), db.extract('month', User.firstUse)). \ order_by(db.extract('year', User.firstUse), db.extract('month', User.firstUse)) months = [] users = 0 for row in query.all(): year, month, count = row months.append({'year': year, 'month': month, 'count':count}) users += count scripts = Screenplay.count() return self.render('stats.html', months=months, users=users, scripts=scripts)
def index(self): query = User.query.with_entities(db.extract('year', User.firstUse), db.extract('month', User.firstUse), db.func.count()). \ group_by(db.extract('year', User.firstUse), db.extract('month', User.firstUse)). \ order_by(db.extract('year', User.firstUse), db.extract('month', User.firstUse)) months = [] users = 0 for row in query.all(): year, month, count = row months.append({'year': year, 'month': month, 'count': count}) users += count scripts = Screenplay.count() return self.render('stats.html', months=months, users=users, scripts=scripts)