示例#1
0
def error(request):
    if request.method == "POST":
        Error.track(request.raw_post_data)
        return HttpResponse("logged, thanks!")
    else:
        data = {
            'count_today': Error.today(),
            'count_month': Error.month(),
            'count': Error.count(),
            'latest': [x.to_dict() for x in Error.latest()]
        }
        return HttpResponse(json.dumps(data), mimetype='application/json')
示例#2
0
def errors(request):
    text = '\n'.join([x.when.isoformat() + " =>" + x.error for x in Error.latest()])
    return HttpResponse(text, mimetype='text/plain')