Skip to content

Commit

Permalink
Pregenerate link url
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick11514 committed Oct 9, 2024
1 parent 6216866 commit 909d028
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections import defaultdict

import django.http
from django.shortcuts import get_object_or_404
from django.shortcuts import get_object_or_404, resolve_url
from django.http import HttpRequest, HttpResponseBadRequest
from django.views.decorators.http import require_POST
from django.contrib.auth.models import User
Expand Down Expand Up @@ -97,6 +97,7 @@ def tasks_list_all(request: HttpRequest, subject_abbr: str | None = None):
"path": task.code,
"subject": task.subject.abbr,
"date": task.created_at,
"link": resolve_url("teacher_task", task_id=task.pk),
}
)
return JsonResponse({"tasks": result, "count": allCount})
Expand Down

0 comments on commit 909d028

Please sign in to comment.