Skip to content

Commit 486e394

Browse files
committed
Added more document information to the personal profile pages at /person/<full name>, after a suggestion from Benoit Claise. Fixes issue ietf-tools#2066.
- Legacy-Id: 12447
1 parent 5e48d7e commit 486e394

3 files changed

Lines changed: 24 additions & 10 deletions

File tree

ietf/doc/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ def related_that_doc(self, relationship):
329329
def all_related_that_doc(self, relationship, related=None):
330330
return list(set([x.target for x in self.all_relations_that_doc(relationship)]))
331331

332+
def replaced_by(self):
333+
return [ r.document for r in self.related_that("replaces") ]
334+
332335
class Meta:
333336
abstract = True
334337

ietf/person/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ def has_drafts(self):
128128
return Document.objects.filter(authors__person=self, type='draft').exists()
129129
def rfcs(self):
130130
from ietf.doc.models import Document
131-
return Document.objects.filter(authors__person=self, type='draft', states__slug='rfc').order_by('-time')
131+
rfcs = list(Document.objects.filter(authors__person=self, type='draft', states__slug='rfc'))
132+
rfcs.sort(key=lambda d: d.canonical_name() )
133+
return rfcs
132134
def active_drafts(self):
133135
from ietf.doc.models import Document
134136
return Document.objects.filter(authors__person=self, type='draft', states__slug='active').order_by('-time')

ietf/templates/person/profile.html

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{% load origin %}
44
{% load markup_tags %}
55
{% load staticfiles %}
6+
{% load ietf_filters %}
67

78
{% block title %}Profile for {{ persons.0 }}{% endblock %}
89

@@ -34,12 +35,16 @@ <h1>{{ person.name }}</h1>
3435

3536
<div class="col-md-6">
3637
<h2>RFCs</h2>
37-
{% if person.rfcs.exists %}
38-
<list>
39-
{% for doc in person.rfcs %}
40-
<li> <a href="{{ doc.get_absolute_url }}">{{ doc.canonical_name }}</a></li>
41-
{% endfor %}
42-
</list>
38+
{% if person.rfcs %}
39+
<table class="table">
40+
{% for doc in person.rfcs %}
41+
<tr>
42+
<td><a href="{{ doc.href }}">{{ doc.canonical_name }}</a></td>
43+
<td>{{ doc.pub_date|date:"b Y"|title|nbsp }}</td>
44+
<td>{{ doc.title }}</td>
45+
</tr>
46+
{% endfor %}
47+
</table>
4348
{% else %}
4449
{{ person.first_name }} has no RFCs as of {{ today }}.
4550
{% endif %}
@@ -49,19 +54,23 @@ <h2>Active Drafts</h2>
4954
{% if person.active_drafts.exists %}
5055
<list>
5156
{% for doc in person.active_drafts %}
52-
<li> <a href="{{ doc.get_absolute_url }}">{{ doc.canonical_name }}</a></li>
57+
<li>
58+
<a href="{{ doc.href }}">{{ doc.canonical_name }}</a>
59+
</li>
5360
{% endfor %}
5461
</list>
5562
{% else %}
5663
{{ person.first_name }} has no active drafts as of {{ today }}.
5764
{% endif %}
5865
</div>
5966
<div class="col-md-6">
60-
<h2>Expired Drafts</h2>
67+
<h2>Expired Drafts <small>exluding replaced drafts</small></h2>
6168
{% if person.expired_drafts.exists %}
6269
<list>
6370
{% for doc in person.expired_drafts %}
64-
<li> <a href="{{ doc.get_absolute_url }}">{{ doc.canonical_name }}</a></li>
71+
{% if not doc.replaced_by %}
72+
<li><a href="{{ doc.href }}">{{ doc.canonical_name }}</a></li>
73+
{% endif %}
6574
{% endfor %}
6675
</list>
6776
{% else %}

0 commit comments

Comments
 (0)