@login_required
def ping_details(request, code, n=None):
    (check, rw) = _get_check_for_user(request, code)
    q = Ping.objects.filter(owner=check)
    if n:
        q = q.filter(n=n)
    try:
        ping = q.latest('created')
    except Ping.DoesNotExist:
        return render(request, 'front/ping_details_not_found.html')
    ctx = {'check': check, 'ping': ping}
    return render(request, 'front/ping_details.html', ctx)
@login_required
def ping_details(request, code, n=None):
    (check, rw) = _get_check_for_user(request, code)
    q = Ping.objects.filter(owner=check)
    if n:
        q = q.filter(n=n)
    try:
        ping = q.latest('created')
    except Ping.DoesNotExist:
        return render(request, 'front/ping_details_not_found.html')
    ctx = {'check': check, 'ping': ping}
    return render(request, 'front/ping_details.html', ctx)