mirror of
https://github.com/ae-utbm/sith.git
synced 2025-12-29 23:28:00 +00:00
Don't craft urls in pedagogy frontend
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from typing import Annotated, Literal
|
||||
|
||||
from django.db.models import Q
|
||||
from django.urls import reverse
|
||||
from django.utils import html
|
||||
from haystack.query import SearchQuerySet
|
||||
from ninja import FilterLookup, FilterSchema, ModelSchema, Schema
|
||||
@@ -85,6 +86,22 @@ class SimpleUeSchema(ModelSchema):
|
||||
"department",
|
||||
]
|
||||
|
||||
detail_url: str
|
||||
edit_url: str
|
||||
delete_url: str
|
||||
|
||||
@staticmethod
|
||||
def resolve_detail_url(obj: UE) -> str:
|
||||
return reverse("pedagogy:ue_detail", kwargs={"ue_id": obj.id})
|
||||
|
||||
@staticmethod
|
||||
def resolve_edit_url(obj: UE) -> str:
|
||||
return reverse("pedagogy:ue_update", kwargs={"ue_id": obj.id})
|
||||
|
||||
@staticmethod
|
||||
def resolve_delete_url(obj: UE) -> str:
|
||||
return reverse("pedagogy:ue_delete", kwargs={"ue_id": obj.id})
|
||||
|
||||
|
||||
class UeSchema(ModelSchema):
|
||||
"""Our complete representation of an UE"""
|
||||
|
||||
Reference in New Issue
Block a user