8b3efa91b1b6b8de049444c31b69efb9b60a179f
[redakcja.git] / src / sources / management / commands / sources_process.py
1 from django.core.management.base import BaseCommand
2 from django.db.models import F
3 from sources.models import Source
4
5
6 class Command(BaseCommand):
7     def handle(self, **options):
8         for s in Source.objects.exclude(
9                 modified_at=None
10         ).exclude(processed_at__gt=F('modified_at')).order_by('modified_at'):
11             print(s)
12             try:
13                 s.process()
14             except Exception as e:
15                 print(e)
16                 pass
17