diff --git a/hc/api/models.py b/hc/api/models.py index 8735b87f..5191508a 100644 --- a/hc/api/models.py +++ b/hc/api/models.py @@ -104,7 +104,7 @@ class Check(models.Model): """ - pings = Ping.objects.filter(owner=self).order_by("-created") + pings = Ping.objects.filter(owner=self).order_by("-id") cutoff = pings[keep_limit:keep_limit+1] # If cutoff is empty slice then the check has less than `keep_limit` diff --git a/hc/api/tests/test_check_model.py b/hc/api/tests/test_check_model.py index 0c559a7d..2d37ed29 100644 --- a/hc/api/tests/test_check_model.py +++ b/hc/api/tests/test_check_model.py @@ -9,7 +9,7 @@ class CheckModelTestCase(TestCase): check.save() for i in range(0, 6): - p = Ping(pk=100 + i, owner=check, ua="UA%d" % i) + p = Ping(owner=check, ua="UA%d" % i) p.save() check.prune_pings(keep_limit=3)