Private
Public Access
1
0

adding link to Home, delayed tasks working

This commit is contained in:
Sander Roosendaal
2022-06-29 16:17:37 +02:00
parent 22f3708120
commit a47ae2bc5b
10 changed files with 87 additions and 8 deletions

View File

@@ -2,12 +2,16 @@ from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.contrib import messages
import collections
# Create your views here.
from django.views.generic.edit import CreateView
from boatmovers.models import Athlete, Crew, Race, Result
import boatmovers.tasks as tasks
import django_rq
queue = django_rq.get_queue('high')
class AthleteCreateView(CreateView):
model = Athlete
@@ -106,7 +110,9 @@ def race_verify(request, id=0):
def race_process(request, id=0):
race = get_object_or_404(Race, pk=id)
outcome = race.process()
job = queue.enqueue(tasks.race_process,race.id)
#outcome = race.process()
messages.info(request,"Your race is being processed. Reload to get the new status.")
return HttpResponseRedirect(reverse('race_view',kwargs={'id':race.id}))