From b592e5b449bf041dffe624ad7c0255a38c279197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Fri, 8 Jan 2016 12:48:36 +0200 Subject: [PATCH] prunepingsslow command skips checks with user_id=null --- hc/api/management/commands/prunepingsslow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hc/api/management/commands/prunepingsslow.py b/hc/api/management/commands/prunepingsslow.py index 87c1c5e1..56b0bcdd 100644 --- a/hc/api/management/commands/prunepingsslow.py +++ b/hc/api/management/commands/prunepingsslow.py @@ -20,8 +20,8 @@ class Command(BaseCommand): for user in User.objects.filter(profile=None): Profile.objects.for_user(user) - checks = Check.objects.annotate( - limit=F("user__profile__ping_log_limit")) + checks = Check.objects.filter(user__isnull=False) + checks = checks.annotate(limit=F("user__profile__ping_log_limit")) for check in checks: q = Ping.objects.filter(owner_id=check.id)