diff --git a/isic/core/templates/core/image_detail/right_panel.html b/isic/core/templates/core/image_detail/right_panel.html index f1dce8c7..d4a82df9 100644 --- a/isic/core/templates/core/image_detail/right_panel.html +++ b/isic/core/templates/core/image_detail/right_panel.html @@ -39,5 +39,25 @@ {% endfor %} + +
+
Belongs to
+
+ {% if image.accession.patient %} + + {{ image.accession.patient.id }} + +
+ {% endif %} + + {% if image.accession.lesion %} + + {{ image.accession.lesion.id }} + +
+ {% endif %} +
+
+ diff --git a/isic/ingest/models/lesion.py b/isic/ingest/models/lesion.py index 47ce0c3f..e9e49cb1 100644 --- a/isic/ingest/models/lesion.py +++ b/isic/ingest/models/lesion.py @@ -14,6 +14,7 @@ from django.db.models.functions.comparison import Coalesce from django.db.models.query import QuerySet from django.db.models.query_utils import Q +from django.urls import reverse from isic.core.constants import LESION_ID_REGEX @@ -228,6 +229,9 @@ class Meta: def __str__(self): return f"{self.private_lesion_id}->{self.id}" + def get_absolute_url(self): + return reverse("core/lesion-detail", kwargs={"identifier": self.id}) + def to_elasticsearch_document(self, *, body_only: bool = False) -> dict | EsLesionDocument: document: EsLesionDocument = {"lesion_id": self.pk, "images": []}