-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command to send validated tenders
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
lemarche/tenders/management/commands/send_validated_tenders.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.core.management.base import BaseCommand | ||
|
||
from lemarche.tenders.models import Tender | ||
from lemarche.www.tenders.tasks import send_validated_tender | ||
|
||
|
||
class Command(BaseCommand): | ||
""" | ||
Command to send validated tenders | ||
Usage: python manage.py send_validated_tenders | ||
""" | ||
|
||
def handle(self, *args, **options): | ||
validated_tenders_to_send = Tender.objects.validated_but_not_sent() | ||
if validated_tenders_to_send.count(): | ||
self.stdout.write(f"Found {validated_tenders_to_send.count()} validated tender(s) to send") | ||
for tender in validated_tenders_to_send: | ||
send_validated_tender(tender) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters