Added more document information to the personal profile pages at /person/<full name>, after a suggestion from Benoit Claise. Fixes issue #2066.

- Legacy-Id: 12447
This commit is contained in:
Henrik Levkowetz 2016-12-05 13:00:01 +00:00
parent 5e48d7ec72
commit 486e394cbf
3 changed files with 24 additions and 10 deletions

View file

@ -329,6 +329,9 @@ class DocumentInfo(models.Model):
def all_related_that_doc(self, relationship, related=None):
return list(set([x.target for x in self.all_relations_that_doc(relationship)]))
def replaced_by(self):
return [ r.document for r in self.related_that("replaces") ]
class Meta:
abstract = True

View file

@ -128,7 +128,9 @@ class PersonInfo(models.Model):
return Document.objects.filter(authors__person=self, type='draft').exists()
def rfcs(self):
from ietf.doc.models import Document
return Document.objects.filter(authors__person=self, type='draft', states__slug='rfc').order_by('-time')
rfcs = list(Document.objects.filter(authors__person=self, type='draft', states__slug='rfc'))
rfcs.sort(key=lambda d: d.canonical_name() )
return rfcs
def active_drafts(self):
from ietf.doc.models import Document
return Document.objects.filter(authors__person=self, type='draft', states__slug='active').order_by('-time')

View file

@ -3,6 +3,7 @@
{% load origin %}
{% load markup_tags %}
{% load staticfiles %}
{% load ietf_filters %}
{% block title %}Profile for {{ persons.0 }}{% endblock %}
@ -34,12 +35,16 @@
<div class="col-md-6">
<h2>RFCs</h2>
{% if person.rfcs.exists %}
<list>
{% for doc in person.rfcs %}
<li> <a href="{{ doc.get_absolute_url }}">{{ doc.canonical_name }}</a></li>
{% endfor %}
</list>
{% if person.rfcs %}
<table class="table">
{% for doc in person.rfcs %}
<tr>
<td><a href="{{ doc.href }}">{{ doc.canonical_name }}</a></td>
<td>{{ doc.pub_date|date:"b Y"|title|nbsp }}</td>
<td>{{ doc.title }}</td>
</tr>
{% endfor %}
</table>
{% else %}
{{ person.first_name }} has no RFCs as of {{ today }}.
{% endif %}
@ -49,7 +54,9 @@
{% if person.active_drafts.exists %}
<list>
{% for doc in person.active_drafts %}
<li> <a href="{{ doc.get_absolute_url }}">{{ doc.canonical_name }}</a></li>
<li>
<a href="{{ doc.href }}">{{ doc.canonical_name }}</a>
</li>
{% endfor %}
</list>
{% else %}
@ -57,11 +64,13 @@
{% endif %}
</div>
<div class="col-md-6">
<h2>Expired Drafts</h2>
<h2>Expired Drafts <small>exluding replaced drafts</small></h2>
{% if person.expired_drafts.exists %}
<list>
{% for doc in person.expired_drafts %}
<li> <a href="{{ doc.get_absolute_url }}">{{ doc.canonical_name }}</a></li>
{% if not doc.replaced_by %}
<li><a href="{{ doc.href }}">{{ doc.canonical_name }}</a></li>
{% endif %}
{% endfor %}
</list>
{% else %}