@login_required
def status_single(request, code):
    (check, rw) = _get_check_for_user(request, code)
    status = check.get_status()
    events = _get_events(check, 20)
    updated = '1'
    if len(events):
        updated = str(events[0].created.timestamp())
    doc = {'status': status, 'status_text': STATUS_TEXT_TMPL.render({'check': check, 'rw': rw}), 'title': down_title(check), 'updated': updated}
    if (updated != request.GET.get('u')):
        doc['events'] = EVENTS_TMPL.render({'check': check, 'events': events})
        doc['downtimes'] = DOWNTIMES_TMPL.render({'downtimes': check.downtimes(3)})
    return JsonResponse(doc)
@login_required
def status_single(request, code):
    (check, rw) = _get_check_for_user(request, code)
    status = check.get_status()
    events = _get_events(check, 20)
    updated = '1'
    if len(events):
        updated = str(events[0].created.timestamp())
    doc = {'status': status, 'status_text': STATUS_TEXT_TMPL.render({'check': check, 'rw': rw}), 'title': down_title(check), 'updated': updated}
    if (updated != request.GET.get('u')):
        doc['events'] = EVENTS_TMPL.render({'check': check, 'events': events})
        doc['downtimes'] = DOWNTIMES_TMPL.render({'downtimes': check.downtimes(3)})
    return JsonResponse(doc)