From 9e4166393d085b8bd4729976ac2061076dc802bc Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Mon, 25 Sep 2023 15:39:48 -0500 Subject: [PATCH] fix: cleaner search_result_row diff links for recent drafts replacing other drafts --- ietf/doc/models.py | 7 +------ ietf/templates/doc/search/search_result_row.html | 4 +++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ietf/doc/models.py b/ietf/doc/models.py index 0f7eb2444..b87448dff 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -512,12 +512,7 @@ class DocumentInfo(models.Model): return list(set([x.target for x in self.all_relations_that_doc(relationship)])) def replaces(self): - return set([ d for r in self.related_that_doc("replaces") for d in r.docs.all() ]) - - def replaces_name(self): - s = set([ r.document for r in self.related_that_doc("replaces")]) - first = list(s)[0] if s else None - return None if first is None else first.filename_with_rev() + return self.related_that_doc("replaces") def replaced_by(self): return set([ r.document for r in self.related_that("replaces") ]) diff --git a/ietf/templates/doc/search/search_result_row.html b/ietf/templates/doc/search/search_result_row.html index f6d7975dc..57ad1f01a 100644 --- a/ietf/templates/doc/search/search_result_row.html +++ b/ietf/templates/doc/search/search_result_row.html @@ -110,7 +110,9 @@ {% if doc.rev != "00" %} {% elif doc.replaces %} - + {% with first_replaces=doc.replaces|first %} + + {% endwith %} {% endif %} {% endif %} {% if doc.type_id == "rfc" %}