diff --git a/peachjam/templates/peachjam/layouts/document_detail.html b/peachjam/templates/peachjam/layouts/document_detail.html index 60c8bfa2e..fe208aff5 100644 --- a/peachjam/templates/peachjam/layouts/document_detail.html +++ b/peachjam/templates/peachjam/layouts/document_detail.html @@ -207,20 +207,18 @@

{{ document.title }}

{% endif %} {% endwith %} - {% with document.bench.all as judges %} - {% if judges %} -
- {% trans 'Judges' %} -
-
- {% for bench in judges %} - {# djlint:off #} - {{ bench.judge.name }}{% if not forloop.last %},{% endif %} - {# djlint:on #} - {% endfor %} -
- {% endif %} - {% endwith %} + {% if judges %} +
+ {% trans 'Judges' %} +
+
+ {% for judge in judges %} + {# djlint:off #} + {{ judge }}{% if not forloop.last %},{% endif %} + {# djlint:on #} + {% endfor %} +
+ {% endif %} {% endblock %} {% block document-metadata-content-date %} {% if document.doc_type == "judgment" %} diff --git a/peachjam/views/judgment.py b/peachjam/views/judgment.py index 306f18843..135afb24f 100644 --- a/peachjam/views/judgment.py +++ b/peachjam/views/judgment.py @@ -23,3 +23,14 @@ def get_context_data(self, **kwargs): class JudgmentDetailView(BaseDocumentDetailView): model = Judgment template_name = "peachjam/judgment_detail.html" + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context.update( + { + "judges": self.get_object() + .bench.prefetch_related("judge") + .values_list("judge__name", flat=True) + } + ) + return context