|
@ -1,6 +1,7 @@ |
|
|
import json |
|
|
import json |
|
|
|
|
|
|
|
|
from django.contrib.humanize.templatetags.humanize import naturaltime |
|
|
from django.contrib.humanize.templatetags.humanize import naturaltime |
|
|
|
|
|
from django.db.models import F |
|
|
from django.http import HttpResponse, HttpResponseBadRequest |
|
|
from django.http import HttpResponse, HttpResponseBadRequest |
|
|
from django.utils import timezone |
|
|
from django.utils import timezone |
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
from django.views.decorators.csrf import csrf_exempt |
|
@ -16,6 +17,7 @@ def ping(request, code): |
|
|
except Check.DoesNotExist: |
|
|
except Check.DoesNotExist: |
|
|
return HttpResponseBadRequest() |
|
|
return HttpResponseBadRequest() |
|
|
|
|
|
|
|
|
|
|
|
check.n_pings = F("n_pings") + 1 |
|
|
check.last_ping = timezone.now() |
|
|
check.last_ping = timezone.now() |
|
|
if check.status == "new": |
|
|
if check.status == "new": |
|
|
check.status = "up" |
|
|
check.status = "up" |
|
@ -52,6 +54,7 @@ def handle_email(request): |
|
|
except Check.DoesNotExist: |
|
|
except Check.DoesNotExist: |
|
|
continue |
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
check.n_pings = F("n_pings") + 1 |
|
|
check.last_ping = timezone.now() |
|
|
check.last_ping = timezone.now() |
|
|
if check.status == "new": |
|
|
if check.status == "new": |
|
|
check.status = "up" |
|
|
check.status = "up" |
|
|