From ebea729804d8d52dca58002e3465a9b8b160cd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Mint=C4=9Bl?= Date: Wed, 9 Oct 2024 23:52:39 +0200 Subject: [PATCH] Pregenerate link url --- api/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/views.py b/api/views.py index 52c1ddd1..ba9dc98f 100644 --- a/api/views.py +++ b/api/views.py @@ -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 @@ -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})