X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/11acab073dcbe3138f9208229c29220646e7457e..bf3f18ce9313f4929ff327fbf12803157de171cb:/apps/funding/management/commands/funding_notify.py?ds=sidebyside diff --git a/apps/funding/management/commands/funding_notify.py b/apps/funding/management/commands/funding_notify.py index a583b2785..1a30ffc90 100755 --- a/apps/funding/management/commands/funding_notify.py +++ b/apps/funding/management/commands/funding_notify.py @@ -14,20 +14,25 @@ class Command(BaseCommand): help = 'Sends relevant funding notifications.' def handle(self, **options): - + from datetime import date, timedelta from funding.models import Offer from funding import app_settings + from django.core.cache import caches + from django.conf import settings verbose = options['verbose'] for offer in Offer.past().filter(notified_end=None): if verbose: print 'Notify end:', offer + # The 'WL fund' list needs to be updated. + caches[settings.CACHE_MIDDLEWARE_ALIAS].clear() + offer.flush_includes() offer.notify_end() current = Offer.current() - if (current is not None and + if (current is not None and current.end <= date.today() + timedelta(app_settings.DAYS_NEAR - 1) and not current.notified_near): if verbose: