Skip to content

Commit

Permalink
Add UX to poll and display link
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkcuys committed Jun 20, 2024
1 parent 420313d commit 1967949
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions studygroups/views/staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from django.db.models import F, Case, When, Value, Sum, IntegerField

from django_celery_results.models import TaskResult
from celery.result import AsyncResult

from studygroups.models import Application
from studygroups.models import StudyGroup
Expand Down Expand Up @@ -80,15 +81,15 @@ def get(self, request, *args, **kwargs):


@method_decorator(user_is_staff, name='dispatch')
class ExportStatusView(SingleObjectMixin, View):
model = TaskResult
pk_url_kwarg = 'task_id'
class ExportStatusView(View):

def get(self, request, *args, **kwargs):
result = get_object_or_404(TaskResult, task_id= kwargs.get('task_id'))
task_id = kwargs.get('task_id')
#result = get_object_or_404(TaskResult, task_id=task_id)
# TODO - check that the task was an export
# TODO - return usefull data for the task
return json_response(request, {'task_id': result.task_id, 'status': result.status})
result = AsyncResult(task_id)
return json_response(request, {'task_id': result.task_id, 'status': result.state, 'result': result.result})


@method_decorator(user_is_staff, name='dispatch')
Expand Down

0 comments on commit 1967949

Please sign in to comment.