Example #1
0
def users_view(request):
    def parse(x):
        return [x[0].strftime('%b, %d, %Y')] + [x[1]] + [x[2]] + [x[3]] + [x[4]]
    username = request.matchdict['username']
    drop_count = drink_log.get_drop_count(username)
    if drop_count:
        return {'username': username, 'hours': drink_log.top_hours(username),
                'top_drinks': drink_log.top_drinks(15, username),
                'drop_count': drop_count, 'error': False,
                'latest_drops': map(parse, drink_log.get_latest_drops(username)),
                'money': money_log.money_spent(username)}
    else:
        return {'message': 'There is no information about ' + username, 'username': '******',
                'error': True}
def users_view(request):
    username = request.matchdict["username"]
    drop_count = drink_log.get_drop_count(username)
    if drop_count:
        return {
            "username": username,
            "hours": drink_log.top_hours(username),
            "top_drinks": drink_log.top_drinks(15, username),
            "drop_count": drop_count,
            "error": False,
            "latest_drops": drink_log.get_latest_drops(username),
            "money": money_log.money_spent(username),
        }
    else:
        return {"message": "There is no information about " + username, "error": True}