def status(request): checks = list(Check.objects.filter(user_id=request.team.user_id)) details = [] for check in checks: ctx = {"check": check} details.append({ "code": str(check.code), "status": check.get_status(), "last_ping": LAST_PING_TMPL.render(ctx) }) tags_statuses, num_down = _tags_statuses(checks) return JsonResponse({ "details": details, "tags": tags_statuses, "title": num_down_title(num_down) })
def status(request, username): if not _has_access(request, username): raise Http404("not found") checks = list(Check.objects.filter(user__username=username)) details = [] for check in checks: ctx = {"check": check} details.append({ "code": str(check.code), "status": check.get_status(), "last_ping": LAST_PING_TMPL.render(ctx) }) tags_statuses, num_down = _tags_statuses(checks) return JsonResponse({ "details": details, "tags": tags_statuses, "title": num_down_title(num_down) })
def status(request): checks = list(Check.objects.filter(user_id=request.team.user_id)) details = [] for check in checks: status = "grace" if check.in_grace_period() else check.get_status() ctx = {"check": check} details.append({ "code": str(check.code), "status": status, "last_ping": render_to_string("front/last_ping_cell.html", ctx) }) tags_statuses, num_down = _tags_statuses(checks) return JsonResponse({ "details": details, "tags": tags_statuses, "title": num_down_title(num_down) })