X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/049c5959e33d29e4c0044c235d291144d49d3c45..4e8fc8e3b409859927393db2e40877df3e74208f:/src/sources/management/commands/sources_process.py?ds=inline diff --git a/src/sources/management/commands/sources_process.py b/src/sources/management/commands/sources_process.py index 8b3efa91..7053e5fc 100644 --- a/src/sources/management/commands/sources_process.py +++ b/src/sources/management/commands/sources_process.py @@ -1,12 +1,14 @@ +from datetime import timedelta from django.core.management.base import BaseCommand from django.db.models import F +from django.utils.timezone import now from sources.models import Source class Command(BaseCommand): def handle(self, **options): - for s in Source.objects.exclude( - modified_at=None + for s in Source.objects.filter( + modified_at__lt=now() - timedelta(seconds=60) ).exclude(processed_at__gt=F('modified_at')).order_by('modified_at'): print(s) try: