context_processors.py 516 B

1234567891011121314151617
  1. from celery import states
  2. from games.models import GameSystem, GameCollection
  3. from django_celery_results.models import TaskResult
  4. IN_PROGRESS_STATES = [states.PENDING, states.STARTED, states.RETRY]
  5. def game_systems(request):
  6. return {
  7. "game_systems": GameSystem.objects.all(),
  8. "game_collections": GameCollection.objects.all(),
  9. "update_in_progress": TaskResult.objects.filter(
  10. task_name="games.tasks.update_roms",
  11. status__in=IN_PROGRESS_STATES,
  12. ),
  13. }