From 49ee9f8cd7112c36a20cb4ba4c702ce46c392b9c Mon Sep 17 00:00:00 2001 From: Bill Fenner Date: Mon, 11 Jun 2007 20:27:14 +0000 Subject: [PATCH] * Implement replaces and replaced_by in search_result_row and idinternal_detail. (This is almost repeating myself, except for slightly different formatting and different links.) * Implement displayname_with_link() to go with filename_with_link(). * Implement idtracker backwards linkage in RFC model. * Don't use unformat_textarea to display Note: - it hasn't been implemented, and seems to want to de-HTML stuff but we're displaying HTML - Legacy-Id: 320 --- ietf/idtracker/models.py | 23 +++++++++++++++--- .../idtracker/idinternal_detail.html | 24 +++++++++++++++++-- .../idtracker/search_result_row.html | 22 ++++++++++++++++- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/ietf/idtracker/models.py b/ietf/idtracker/models.py index de51e3217..b8bb32ea8 100644 --- a/ietf/idtracker/models.py +++ b/ietf/idtracker/models.py @@ -167,11 +167,15 @@ class InternetDraft(models.Model): return "%02d" % r def doctype(self): return "Draft" - def filename_with_link(self): + def filename_with_link(self, text=None): + if text is None: + text=self.filename if self.status.status != 'Active': - return self.filename + return text else: - return '%s' % ( self.doclink(), self.filename ) + return '%s' % ( self.doclink(), text ) + def displayname_with_link(self): + return self.filename_with_link(self.displayname()) class Meta: db_table = "internet_drafts" class Admin: @@ -341,6 +345,19 @@ class Rfc(models.Model): return "RFC" def filename_with_link(self): return '%s' % ( self.doclink(), self.displayname() ) + def displayname_with_link(self): + return self.filename_with_link() + _idinternal_cache = None + _idinternal_cached = False + def idinternal(self): + if self._idinternal_cached: + return self._idinternal_cache + try: + self._idinternal_cache = IDInternal.objects.get(draft=self.rfc_number, rfc_flag=1) + except IDInternal.DoesNotExist: + self._idinternal_cache = None + self._idinternal_cached = True + return self._idinternal_cache class Meta: db_table = 'rfcs' verbose_name = 'RFC' diff --git a/ietf/templates/idtracker/idinternal_detail.html b/ietf/templates/idtracker/idinternal_detail.html index 0a5a05307..6a53855db 100644 --- a/ietf/templates/idtracker/idinternal_detail.html +++ b/ietf/templates/idtracker/idinternal_detail.html @@ -29,7 +29,7 @@
- {{ object.document.filename_with_link }} + {{ object.document.displayname_with_link }} {% ifnotequal object.document.status.status "Active" %} ({{ object.document.status.status }}) {% endifnotequal %} @@ -44,6 +44,25 @@ {% endifequal %} {% endif %} + {% ifequal object.document.status.status "Replaced" %} +
Replaced by + {% if object.document.replaced_by.idinternal %} + + {% endif %} + {{ object.document.replaced_by.filename }} + {% if object.document.replaced_by.idinternal %} + + {% endif %} + {% endifequal %} + {% if object.document.replaces_set.count %} +
Replaces + {% for replaces in object.document.replaces_set.all %} + {% if replaces.idinternal %} + + {% endif %} + {{ replaces.filename }}{% if replaces.idinternal %}{% endif %}{% if not forloop.last %},{% endif %} + {% endfor %} + {% endif %}
@@ -179,7 +198,8 @@
- {% firstof object.note|unformat_textarea   %} + {# |unformat_textarea #} + {% firstof object.note   %}
diff --git a/ietf/templates/idtracker/search_result_row.html b/ietf/templates/idtracker/search_result_row.html index 4bf3f3f2d..8f4df03d8 100644 --- a/ietf/templates/idtracker/search_result_row.html +++ b/ietf/templates/idtracker/search_result_row.html @@ -5,7 +5,27 @@ invalid HTML. -->
{# todo: conditionalize doclink properly #} - {% if match.primary_flag %}
  • {% else %}
    {% endif %}{{ match.document.filename_with_link }} ({{ match.document.intended_status }}) + {% if match.primary_flag %}
  • {% else %}
    {% endif %}{{ match.document.filename_with_link }} ({{ match.document.intended_status }}) + {% ifequal match.document.status.status "Replaced" %} +
        Replaced by + {% if match.document.replaced_by.idinternal %} + + {% endif %} + {{ match.document.replaced_by.filename }} + {% if match.document.replaced_by.idinternal %} + + {% endif %} + {% endifequal %} + {% if match.document.replaces_set.count %} +
        Replaces + {% for replaces in match.document.replaces_set.all %} + {% if replaces.idinternal %} + + {% endif %} + {{ replaces.filename }}{% if replaces.idinternal %}{% endif %}{% if not forloop.last %},{% endif %} + {% endfor %} + {% endif %} + {{ match.document.revision }} {{ match.job_owner }} {% firstof match.status_date "" %}