Summary: Make sure liaison edit page is using full URL to attachments
to not confuse the crawler, and make all liaison pages use the setting from settings instead of hardcoding it - Legacy-Id: 10125
This commit is contained in:
parent
873af386df
commit
40308d429b
|
@ -7,6 +7,7 @@ from django.utils.feedgenerator import Atom1Feed
|
|||
from django.template.loader import render_to_string
|
||||
from django.db.models import Q
|
||||
from django.core.urlresolvers import reverse as urlreverse, reverse_lazy
|
||||
from django.conf import settings
|
||||
|
||||
from ietf.group.models import Group
|
||||
from ietf.liaisons.models import LiaisonStatement
|
||||
|
@ -17,7 +18,6 @@ from ietf.liaisons.models import LiaisonStatement
|
|||
class LiaisonStatementsFeed(Feed):
|
||||
feed_type = Atom1Feed
|
||||
link = reverse_lazy("liaison_list")
|
||||
description_template = "liaisons/feed_item_description.html"
|
||||
|
||||
def get_object(self, request, kind, search=None):
|
||||
obj = {}
|
||||
|
@ -75,7 +75,10 @@ class LiaisonStatementsFeed(Feed):
|
|||
if obj.has_key('filter'):
|
||||
qs = qs.filter(**obj['filter'])
|
||||
if obj.has_key('limit'):
|
||||
qs = qs[:obj['limit']]
|
||||
qs = qs[:obj['limit']]
|
||||
|
||||
qs = qs.prefetch_related("attachments")
|
||||
|
||||
return qs
|
||||
|
||||
def title(self, obj):
|
||||
|
@ -87,6 +90,13 @@ class LiaisonStatementsFeed(Feed):
|
|||
def item_title(self, item):
|
||||
return render_to_string("liaisons/liaison_title.html", { 'liaison': item }).strip()
|
||||
|
||||
def item_description(self, item):
|
||||
return render_to_string("liaisons/feed_item_description.html", {
|
||||
'liaison': item,
|
||||
"liaison_attach_url": settings.LIAISON_ATTACH_URL,
|
||||
"attachments": item.attachments.all(),
|
||||
})
|
||||
|
||||
def item_link(self, item):
|
||||
return urlreverse("liaison_detail", kwargs={ "object_id": item.pk })
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ def send_liaison_by_email(request, liaison):
|
|||
liaison=liaison,
|
||||
url=settings.IDTRACKER_BASE_URL + urlreverse("liaison_detail", kwargs=dict(object_id=liaison.pk)),
|
||||
referenced_url=settings.IDTRACKER_BASE_URL + urlreverse("liaison_detail", kwargs=dict(object_id=liaison.related_to.pk)) if liaison.related_to else None,
|
||||
liaison_attach_url=settings.LIAISON_ATTACH_URL,
|
||||
))
|
||||
|
||||
send_mail_text(request, to_email, from_email, subject, body, cc=", ".join(cc), bcc=", ".join(bcc))
|
||||
|
@ -46,6 +47,7 @@ def notify_pending_by_email(request, liaison):
|
|||
liaison=liaison,
|
||||
url=settings.IDTRACKER_BASE_URL + urlreverse("liaison_approval_detail", kwargs=dict(object_id=liaison.pk)),
|
||||
referenced_url=settings.IDTRACKER_BASE_URL + urlreverse("liaison_detail", kwargs=dict(object_id=liaison.related_to.pk)) if liaison.related_to else None,
|
||||
liaison_attach_url=settings.LIAISON_ATTACH_URL,
|
||||
))
|
||||
# send_mail_text(request, to_email, from_email, subject, body)
|
||||
send_mail_text(request, ['statements@ietf.org'], from_email, subject, body)
|
||||
|
@ -107,6 +109,7 @@ def possibly_send_deadline_reminder(liaison):
|
|||
days_msg=days_msg,
|
||||
url=settings.IDTRACKER_BASE_URL + urlreverse("liaison_approval_detail", kwargs=dict(object_id=liaison.pk)),
|
||||
referenced_url=settings.IDTRACKER_BASE_URL + urlreverse("liaison_detail", kwargs=dict(object_id=liaison.related_to.pk)) if liaison.related_to else None,
|
||||
liaison_attach_url=settings.LIAISON_ATTACH_URL,
|
||||
))
|
||||
|
||||
send_mail_text(None, to_email, from_email, subject, body, cc=cc, bcc=bcc)
|
||||
|
|
|
@ -5,8 +5,8 @@ from email.utils import parseaddr
|
|||
|
||||
from django.core.validators import validate_email, ValidationError
|
||||
from django.http import HttpResponse, HttpResponseForbidden
|
||||
from django.shortcuts import render_to_response, get_object_or_404, redirect
|
||||
from django.template import RequestContext
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.conf import settings
|
||||
|
||||
from ietf.liaisons.models import LiaisonStatement
|
||||
from ietf.liaisons.accounts import (get_person_for_user, can_add_outgoing_liaison,
|
||||
|
@ -39,12 +39,10 @@ def add_liaison(request, liaison=None):
|
|||
else:
|
||||
form = liaison_form_factory(request, liaison=liaison)
|
||||
|
||||
return render_to_response(
|
||||
'liaisons/edit.html',
|
||||
{'form': form,
|
||||
'liaison': liaison},
|
||||
context_instance=RequestContext(request),
|
||||
)
|
||||
return render(request, 'liaisons/edit.html', {
|
||||
'form': form,
|
||||
'liaison': liaison
|
||||
})
|
||||
|
||||
|
||||
@can_submit_liaison_required
|
||||
|
@ -105,14 +103,15 @@ def liaison_list(request):
|
|||
|
||||
approvable = approvable_liaison_statements(request.user).count()
|
||||
|
||||
return render_to_response('liaisons/overview.html', {
|
||||
return render(request, 'liaisons/overview.html', {
|
||||
"liaisons": liaisons,
|
||||
"can_manage": approvable or can_send_incoming or can_send_outgoing,
|
||||
"approvable": approvable,
|
||||
"can_send_incoming": can_send_incoming,
|
||||
"can_send_outgoing": can_send_outgoing,
|
||||
"sort": sort,
|
||||
}, context_instance=RequestContext(request))
|
||||
"liaison_attach_url": settings.LIAISON_ATTACH_URL,
|
||||
})
|
||||
|
||||
def ajax_select2_search_liaison_statements(request):
|
||||
q = [w.strip() for w in request.GET.get('q', '').split() if w.strip()]
|
||||
|
@ -133,9 +132,9 @@ def ajax_select2_search_liaison_statements(request):
|
|||
def liaison_approval_list(request):
|
||||
liaisons = approvable_liaison_statements(request.user).order_by("-submitted")
|
||||
|
||||
return render_to_response('liaisons/approval_list.html', {
|
||||
return render(request, 'liaisons/approval_list.html', {
|
||||
"liaisons": liaisons,
|
||||
}, context_instance=RequestContext(request))
|
||||
})
|
||||
|
||||
|
||||
@can_submit_liaison_required
|
||||
|
@ -149,10 +148,10 @@ def liaison_approval_detail(request, object_id):
|
|||
send_liaison_by_email(request, liaison)
|
||||
return redirect('liaison_list')
|
||||
|
||||
return render_to_response('liaisons/approval_detail.html', {
|
||||
return render(request, 'liaisons/approval_detail.html', {
|
||||
"liaison": liaison,
|
||||
"is_approving": True,
|
||||
}, context_instance=RequestContext(request))
|
||||
})
|
||||
|
||||
|
||||
def _can_take_care(liaison, user):
|
||||
|
@ -205,12 +204,13 @@ def liaison_detail(request, object_id):
|
|||
|
||||
relations = liaison.liaisonstatement_set.exclude(approved=None)
|
||||
|
||||
return render_to_response("liaisons/detail.html", {
|
||||
return render(request, "liaisons/detail.html", {
|
||||
"liaison": liaison,
|
||||
"can_edit": can_edit,
|
||||
"can_take_care": can_take_care,
|
||||
"relations": relations,
|
||||
}, context_instance=RequestContext(request))
|
||||
"liaison_attach_url": settings.LIAISON_ATTACH_URL,
|
||||
})
|
||||
|
||||
def liaison_edit(request, object_id):
|
||||
liaison = get_object_or_404(LiaisonStatement, pk=object_id)
|
||||
|
|
|
@ -449,7 +449,7 @@ RFC_EDITOR_INDEX_URL = "https://www.rfc-editor.org/rfc/rfc-index.xml"
|
|||
# Liaison Statement Tool settings
|
||||
LIAISON_UNIVERSAL_FROM = 'Liaison Statement Management Tool <lsmt@' + IETF_DOMAIN + '>'
|
||||
LIAISON_ATTACH_PATH = '/a/www/ietf-datatracker/documents/LIAISON/'
|
||||
LIAISON_ATTACH_URL = '/documents/LIAISON/'
|
||||
LIAISON_ATTACH_URL = 'https://datatracker.ietf.org/documents/LIAISON/'
|
||||
|
||||
# NomCom Tool settings
|
||||
ROLODEX_URL = ""
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
<th class="text-nowrap">Attachments</th>
|
||||
<td>
|
||||
{% for doc in liaison.attachments.all %}
|
||||
<a href="https://datatracker.ietf.org/documents/LIAISON/{{ doc.external_url }}">{{ doc.title }}</a>
|
||||
<a href="{{ liaison_attach_url }}{{ doc.external_url }}">{{ doc.title }}</a>
|
||||
{% if not forloop.last %}<br>{% endif %}
|
||||
{% empty %}
|
||||
(None)
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
{# Copyright The IETF Trust 2015, All Rights Reserved #}{% load origin %}{% origin %}
|
||||
{{ obj.body|truncatewords:"30"|wordwrap:"71"|linebreaksbr }}
|
||||
{% with obj.attachments.all as attachments %}
|
||||
<h3>Attached Document{{ attachments|pluralize }}</h3>
|
||||
{% if attachments %}
|
||||
<ul>
|
||||
{% for doc in attachments %}
|
||||
<li><a href="https://datatracker.ietf.org/documents/LIAISON/{{ doc.external_url }}">{{ doc.title }}</a><br>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>NONE</p>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{{ liaison.body|truncatewords:"30"|wordwrap:"71"|linebreaksbr }}
|
||||
|
||||
<h3>Attached Document{{ attachments|pluralize }}</h3>
|
||||
{% if attachments %}
|
||||
<ul>
|
||||
{% for doc in attachments %}
|
||||
<li><a href="{{ liaison_attach_url }}{{ doc.external_url }}">{{ doc.title }}</a><br>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>NONE</p>
|
||||
{% endif %}
|
||||
|
|
|
@ -13,7 +13,7 @@ Body: {{ liaison.body }}
|
|||
Attachments:
|
||||
{% for doc in liaison.attachments.all %}
|
||||
{{ doc.title }}
|
||||
https://datatracker.ietf.org/documents/LIAISON/{{ doc.external_url }}
|
||||
{{ liaison_attach_url }}{{ doc.external_url }}
|
||||
{% empty %}
|
||||
No document has been attached
|
||||
{% endfor %}{% endautoescape %}
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<td>
|
||||
{% if not liaison.from_contact_id %}
|
||||
{% for doc in liaison.attachments.all %}
|
||||
<a href="https://datatracker.ietf.org/documents/LIAISON/{{ doc.external_url }}">{{ doc.title }}</a>
|
||||
<a href="{{ liaison_attach_url }}{{ doc.external_url }}">{{ doc.title }}</a>
|
||||
<br>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
|
|
Loading…
Reference in a new issue