* 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
This commit is contained in:
Bill Fenner 2007-06-11 20:27:14 +00:00
parent c05bcfce8f
commit 49ee9f8cd7
3 changed files with 63 additions and 6 deletions

View file

@ -167,11 +167,15 @@ class InternetDraft(models.Model):
return "%02d" % r return "%02d" % r
def doctype(self): def doctype(self):
return "Draft" 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': if self.status.status != 'Active':
return self.filename return text
else: else:
return '<a href="%s">%s</a>' % ( self.doclink(), self.filename ) return '<a href="%s">%s</a>' % ( self.doclink(), text )
def displayname_with_link(self):
return self.filename_with_link(self.displayname())
class Meta: class Meta:
db_table = "internet_drafts" db_table = "internet_drafts"
class Admin: class Admin:
@ -341,6 +345,19 @@ class Rfc(models.Model):
return "RFC" return "RFC"
def filename_with_link(self): def filename_with_link(self):
return '<a href="%s">%s</a>' % ( self.doclink(), self.displayname() ) return '<a href="%s">%s</a>' % ( 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: class Meta:
db_table = 'rfcs' db_table = 'rfcs'
verbose_name = 'RFC' verbose_name = 'RFC'

View file

@ -29,7 +29,7 @@
<td> <td>
<div class="largefont3"> <div class="largefont3">
{{ object.document.filename_with_link }} {{ object.document.displayname_with_link }}
{% ifnotequal object.document.status.status "Active" %} {% ifnotequal object.document.status.status "Active" %}
({{ object.document.status.status }}) ({{ object.document.status.status }})
{% endifnotequal %} {% endifnotequal %}
@ -44,6 +44,25 @@
{% endifequal %} {% endifequal %}
{% endif %} {% endif %}
</font> </font>
{% ifequal object.document.status.status "Replaced" %}
<br>Replaced by
{% if object.document.replaced_by.idinternal %}
<a href="{{ object.document.replaced_by.idinternal.get_absolute_url }}">
{% endif %}
{{ object.document.replaced_by.filename }}
{% if object.document.replaced_by.idinternal %}
</a>
{% endif %}
{% endifequal %}
{% if object.document.replaces_set.count %}
<br>Replaces
{% for replaces in object.document.replaces_set.all %}
{% if replaces.idinternal %}
<a href="{{ replaces.idinternal.get_absolute_url }}">
{% endif %}
{{ replaces.filename }}{% if replaces.idinternal %}</a>{% endif %}{% if not forloop.last %},{% endif %}
{% endfor %}
{% endif %}
</div> </div>
</td> </td>
</tr> </tr>
@ -179,7 +198,8 @@
<td> <td>
<div class="largefont3"> <div class="largefont3">
{% firstof object.note|unformat_textarea &nbsp; %} {# |unformat_textarea #}
{% firstof object.note &nbsp; %}
</div> </div>
</td> </td>
</tr> </tr>

View file

@ -5,7 +5,27 @@
invalid HTML. --> invalid HTML. -->
<form method="GET" action="{% url ietf.idtracker.views.view_id match.document.filename %}"><td><input type="submit" value="DETAIL"></td></form> <form method="GET" action="{% url ietf.idtracker.views.view_id match.document.filename %}"><td><input type="submit" value="DETAIL"></td></form>
{# todo: conditionalize doclink properly #} {# todo: conditionalize doclink properly #}
<td>{% if match.primary_flag %}<li>{% else %}<dd>{% endif %}{{ match.document.filename_with_link }} ({{ match.document.intended_status }})</td> <td>{% if match.primary_flag %}<li>{% else %}<dd>{% endif %}{{ match.document.filename_with_link }} ({{ match.document.intended_status }})
{% ifequal match.document.status.status "Replaced" %}
<br>&nbsp;&nbsp;&nbsp;&nbsp;Replaced by
{% if match.document.replaced_by.idinternal %}
<a href="{% url ietf.idtracker.views.search %}?search_filename={{ match.document.replaced_by.filename }}">
{% endif %}
{{ match.document.replaced_by.filename }}
{% if match.document.replaced_by.idinternal %}
</a>
{% endif %}
{% endifequal %}
{% if match.document.replaces_set.count %}
<br>&nbsp;&nbsp;&nbsp;&nbsp;Replaces
{% for replaces in match.document.replaces_set.all %}
{% if replaces.idinternal %}
<a href="{% url ietf.idtracker.views.search %}?search_filename={{ replaces.filename }}">
{% endif %}
{{ replaces.filename }}{% if replaces.idinternal %}</a>{% endif %}{% if not forloop.last %},{% endif %}
{% endfor %}
{% endif %}
</td>
<td>{{ match.document.revision }}</td> <td>{{ match.document.revision }}</td>
<td>{{ match.job_owner }}</td> <td>{{ match.job_owner }}</td>
<td>{% firstof match.status_date "" %}</td> <td>{% firstof match.status_date "" %}</td>