Files
timetracker/games/apps.py
Lukáš Kucharczyk 527cf4ba52
Some checks failed
Django CI/CD / test (push) Failing after 1m19s
Django CI/CD / build-and-push (push) Has been skipped
Make it possible to convert prices automatically
2024-11-10 15:34:08 +01:00

21 lines
614 B
Python

from datetime import timedelta
from django.apps import AppConfig
from django.utils.timezone import now
from django_q.models import Schedule
from django_q.tasks import schedule
class GamesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "games"
def ready(self):
if not Schedule.objects.filter(name="Update converted prices").exists():
schedule(
"games.tasks.update_converted_prices",
name="Update converted prices",
schedule_type="D",
next_run=now() + timedelta(days=1),
)