Refined the links from document stats pages to author pages so as to not link to non-existent pages. Fixes 404 errors in the test crawler logs.

- Legacy-Id: 17237
This commit is contained in:
Henrik Levkowetz 2020-01-17 00:49:01 +00:00
parent 68174ba501
commit e9d3809099
2 changed files with 19 additions and 3 deletions

View file

@ -1,4 +1,4 @@
# Copyright The IETF Trust 2007, All Rights Reserved
# Copyright The IETF Trust 2017-2020, All Rights Reserved
import datetime
@ -7,6 +7,7 @@ from django import template
import debug # pyflakes:ignore
from ietf.meeting.utils import is_nomcom_eligible as util_is_nomcom_eligible
from ietf.person.models import Alias
register = template.Library()
@ -14,3 +15,11 @@ register = template.Library()
def is_nomcom_eligible(person, date=datetime.date.today()):
return util_is_nomcom_eligible(person,date)
@register.filter
def person_by_name(name):
"Look up a person record from name"
if not isinstance(name, (type(b''), type(u''))):
return None
alias = Alias.objects.filter(name=name).first()
return alias.person if alias else None

View file

@ -1,6 +1,13 @@
{% if content_limit and count <= content_limit %}
{% load person_filters %}{% if content_limit and count <= content_limit %}
{% for n in names %}
<a href="{% url 'ietf.person.views.profile' email_or_name=n %}">{{ n }}</a><br>
{% with n|person_by_name as person %}
{% if person %}
<a href="{{ person.get_absolute_url }}">{{ n }}</a>
{% else %}
{{ n }}
{% endif %}
<br>
{% endwith %}
{% endfor %}
{% else %}
{# <a class="popover-details" href="" data-elements="{% for n in names|slice:":20" %}{{ n }}{% if not forloop.last %}|{% endif %}{% endfor %}" data-sliced="{% if count > 20 %}1{% endif %}">{{ count }}</a> #}