Skip to content

Commit 49ee9f8

Browse files
committed
* 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
1 parent c05bcfc commit 49ee9f8

3 files changed

Lines changed: 63 additions & 6 deletions

File tree

ietf/idtracker/models.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,15 @@ def revision_display(self):
167167
return "%02d" % r
168168
def doctype(self):
169169
return "Draft"
170-
def filename_with_link(self):
170+
def filename_with_link(self, text=None):
171+
if text is None:
172+
text=self.filename
171173
if self.status.status != 'Active':
172-
return self.filename
174+
return text
173175
else:
174-
return '<a href="%s">%s</a>' % ( self.doclink(), self.filename )
176+
return '<a href="%s">%s</a>' % ( self.doclink(), text )
177+
def displayname_with_link(self):
178+
return self.filename_with_link(self.displayname())
175179
class Meta:
176180
db_table = "internet_drafts"
177181
class Admin:
@@ -341,6 +345,19 @@ def doctype(self):
341345
return "RFC"
342346
def filename_with_link(self):
343347
return '<a href="%s">%s</a>' % ( self.doclink(), self.displayname() )
348+
def displayname_with_link(self):
349+
return self.filename_with_link()
350+
_idinternal_cache = None
351+
_idinternal_cached = False
352+
def idinternal(self):
353+
if self._idinternal_cached:
354+
return self._idinternal_cache
355+
try:
356+
self._idinternal_cache = IDInternal.objects.get(draft=self.rfc_number, rfc_flag=1)
357+
except IDInternal.DoesNotExist:
358+
self._idinternal_cache = None
359+
self._idinternal_cached = True
360+
return self._idinternal_cache
344361
class Meta:
345362
db_table = 'rfcs'
346363
verbose_name = 'RFC'

ietf/templates/idtracker/idinternal_detail.html

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<td>
3131
<div class="largefont3">
32-
{{ object.document.filename_with_link }}
32+
{{ object.document.displayname_with_link }}
3333
{% ifnotequal object.document.status.status "Active" %}
3434
({{ object.document.status.status }})
3535
{% endifnotequal %}
@@ -44,6 +44,25 @@
4444
{% endifequal %}
4545
{% endif %}
4646
</font>
47+
{% ifequal object.document.status.status "Replaced" %}
48+
<br>Replaced by
49+
{% if object.document.replaced_by.idinternal %}
50+
<a href="{{ object.document.replaced_by.idinternal.get_absolute_url }}">
51+
{% endif %}
52+
{{ object.document.replaced_by.filename }}
53+
{% if object.document.replaced_by.idinternal %}
54+
</a>
55+
{% endif %}
56+
{% endifequal %}
57+
{% if object.document.replaces_set.count %}
58+
<br>Replaces
59+
{% for replaces in object.document.replaces_set.all %}
60+
{% if replaces.idinternal %}
61+
<a href="{{ replaces.idinternal.get_absolute_url }}">
62+
{% endif %}
63+
{{ replaces.filename }}{% if replaces.idinternal %}</a>{% endif %}{% if not forloop.last %},{% endif %}
64+
{% endfor %}
65+
{% endif %}
4766
</div>
4867
</td>
4968
</tr>
@@ -179,7 +198,8 @@
179198

180199
<td>
181200
<div class="largefont3">
182-
{% firstof object.note|unformat_textarea &nbsp; %}
201+
{# |unformat_textarea #}
202+
{% firstof object.note &nbsp; %}
183203
</div>
184204
</td>
185205
</tr>

ietf/templates/idtracker/search_result_row.html

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,27 @@
55
invalid HTML. -->
66
<form method="GET" action="{% url ietf.idtracker.views.view_id match.document.filename %}"><td><input type="submit" value="DETAIL"></td></form>
77
{# todo: conditionalize doclink properly #}
8-
<td>{% if match.primary_flag %}<li>{% else %}<dd>{% endif %}{{ match.document.filename_with_link }} ({{ match.document.intended_status }})</td>
8+
<td>{% if match.primary_flag %}<li>{% else %}<dd>{% endif %}{{ match.document.filename_with_link }} ({{ match.document.intended_status }})
9+
{% ifequal match.document.status.status "Replaced" %}
10+
<br>&nbsp;&nbsp;&nbsp;&nbsp;Replaced by
11+
{% if match.document.replaced_by.idinternal %}
12+
<a href="{% url ietf.idtracker.views.search %}?search_filename={{ match.document.replaced_by.filename }}">
13+
{% endif %}
14+
{{ match.document.replaced_by.filename }}
15+
{% if match.document.replaced_by.idinternal %}
16+
</a>
17+
{% endif %}
18+
{% endifequal %}
19+
{% if match.document.replaces_set.count %}
20+
<br>&nbsp;&nbsp;&nbsp;&nbsp;Replaces
21+
{% for replaces in match.document.replaces_set.all %}
22+
{% if replaces.idinternal %}
23+
<a href="{% url ietf.idtracker.views.search %}?search_filename={{ replaces.filename }}">
24+
{% endif %}
25+
{{ replaces.filename }}{% if replaces.idinternal %}</a>{% endif %}{% if not forloop.last %},{% endif %}
26+
{% endfor %}
27+
{% endif %}
28+
</td>
929
<td>{{ match.document.revision }}</td>
1030
<td>{{ match.job_owner }}</td>
1131
<td>{% firstof match.status_date "" %}</td>

0 commit comments

Comments
 (0)