From 909d02813239910a65ae8acaad18dfb28eaf1e41 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..100dae70 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})