prunepingsslow command skips checks with user_id=null

This commit is contained in:
Pēteris Caune 2016-01-08 12:48:36 +02:00
parent 78e9cddba0
commit b592e5b449

View File

@ -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)