|
|
|
@ -2,14 +2,13 @@ from django.core.management.base import BaseCommand |
|
|
|
from tournaments.tasks import check_confirmation_deadlines |
|
|
|
from tournaments.tasks import check_confirmation_deadlines |
|
|
|
from django.utils import timezone |
|
|
|
from django.utils import timezone |
|
|
|
import datetime |
|
|
|
import datetime |
|
|
|
import pytz |
|
|
|
from background_task.models import Task |
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand): |
|
|
|
class Command(BaseCommand): |
|
|
|
help = 'Schedule background tasks to run at :00 and :30 of every hour' |
|
|
|
help = 'Schedule background tasks to run at :00 and :30 of every hour' |
|
|
|
|
|
|
|
|
|
|
|
def handle(self, *args, **options): |
|
|
|
def handle(self, *args, **options): |
|
|
|
# Clear existing tasks first to avoid duplicates |
|
|
|
# Clear existing tasks first to avoid duplicates |
|
|
|
from background_task.models import Task |
|
|
|
|
|
|
|
Task.objects.filter(task_name='tournaments.tasks.check_confirmation_deadlines').delete() |
|
|
|
Task.objects.filter(task_name='tournaments.tasks.check_confirmation_deadlines').delete() |
|
|
|
|
|
|
|
|
|
|
|
# Get the current timezone-aware time |
|
|
|
# Get the current timezone-aware time |
|
|
|
|