timetracker/games/apps.py

22 lines
655 B
Python

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