Use Role rather than Email when retrieving roles in wginfo - Role has

a link to both the email and the person (but didn't originally with
the new schema) so is better than the going through the email only, do
a couple of extra cleanups too while at it
 - Legacy-Id: 6301
This commit is contained in:
Ole Laursen 2013-09-28 21:10:28 +00:00
parent c419271d97
commit 3701f2ac7d
8 changed files with 69 additions and 88 deletions

View file

@ -4,7 +4,7 @@
{% for area in areas %}{{ area.name }} ({{ area.acronym }})
{{ area.name|dashify }}------{% for ad in area.ads %}
{{ ad.person }} <{{ ad.address }}>{% endfor %}
{{ ad.person.plain_name }} <{{ ad.email.address }}>{% endfor %}
{% for group in area.groups %}{{ group.name }} ({{ group.acronym }})
{% include "wginfo/group_entry.txt" %}

View file

@ -53,47 +53,44 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% for area in areas %}
<h2 class="ietf-divider" id="{{area.name|cut:" "}}">{{ area.name }}</h2>
{% for ad in area.ads %}
{% if forloop.first %}
<p>Area Director{{ forloop.revcounter|pluralize }}:</p>
{% if area.ads %}
<p>Area Director{{ area.ads|pluralize }}:</p>
<table style="margin-left: 2em" class="ietf-wg-table">
{% endif %}
<tr><td><span class="square bgcolor{{forloop.counter}}">&nbsp;</span></td> <td><a href="mailto:{{ ad.address }}">{{ ad.person.plain_name }} &lt;{{ ad.address }}&gt;</a>{% if ad.incoming %} (Incoming AD){% endif %}</td></tr>
{% if forloop.last %}
{% for ad in area.ads %}
<tr>
<td><span class="square bgcolor{{forloop.counter}}">&nbsp;</span></td>
<td><a href="mailto:{{ ad.email.address }}">{{ ad.person.plain_name }} &lt;{{ ad.email.address }}&gt;</a>{% if ad.name == "pre-ad" %} (Incoming AD){% endif %}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endfor %}
{% for url in area.urls %}
{% if forloop.first %}
<p>Area Specific Web Page{{ forloop.revcounter|pluralize}}:</p>
{% if area.urls %}
<p>Area Specific Web Page{{ area.urls|pluralize}}:</p>
<p style="margin-left: 2em">
{% endif %}
{% for url in area.urls %}
<a href="{{ url.url }}">{{ url.name }}</a>{% if not forloop.last %}<br/>{% endif %}
{% if forloop.last %}
{% endfor %}
</p>
{% endif %}
{% endfor %}
{% for wg in area.wgs %}
{% if forloop.first %}
<p>Active Working Groups:</p>
{% if area.groups %}
<p>Active Working Group{{ area.groups|pluralize}}:</p>
<div style="margin-left:2em;">
<table class="ietf-wg-table">
{% endif %}
{% for group in area.groups %}
<tr>
<td width="10%;"><a href="/wg/{{ wg.acronym }}/">{{ wg.acronym }}</a></td>
<td width="1%">{% for ad in area.ads %}{% ifequal ad.person_id wg.ad_id %}<span title="AD for {{ wg.acronym }}: {{ad.person }}" class="square bgcolor{{forloop.counter}}"></span>{% endifequal %}{% endfor %}</td>
<td width="50%">{{ wg.name }}</td>
<td width="39%">{% for chair in wg.chairs %}<a href="mailto:{{ chair.address }}">{{ chair.person.plain_name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
<td width="10%;"><a href="/wg/{{ group.acronym }}/">{{ group.acronym }}</a></td>
<td width="1%">{% for ad in area.ads %}{% if ad.person_id == group.ad_id %}<span title="AD for {{ group.acronym }}: {{ ad.person }}" class="square bgcolor{{forloop.counter}}"></span>{% endif %}{% endfor %}</td>
<td width="50%">{{ group.name }}</td>
<td width="39%">{% for chair in group.chairs %}<a href="mailto:{{ chair.email.address }}">{{ chair.person.plain_name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
</tr>
{% if forloop.last %}
{% endfor %}
</table>
</div>
{% endif %}
{% empty %}
{% else %}
<p>No Active Working Groups</p>
{% endfor %}{# wg #}
{% endif %}
{% endfor %}{# area #}

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}Request closing of WG {{ wg.acronym }}{% endblock %}
{% block title %}Request closing of {{ wg.acronym }} {{ wg.type.name }}{% endblock %}
{% block morecss %}
#id_instructions {
@ -14,22 +14,23 @@ form.conclude .actions {
{% endblock %}
{% block content %}
<h1>Request closing of {{ wg.acronym }}</h1>
<h1>Request closing of {{ wg.acronym }} {{ wg.type.name }}</h1>
<p>
Please provide instructions regarding the disposition of each
active Internet-Draft (such as to withdraw the draft, move it to
another WG, convert it to an individual submission, and so on),
wording for the closure announcement, and the status of the WG
another group, convert it to an individual submission, and so on),
wording for the closure announcement, and the status of the group
mailing list (will it remain open or should it be closed).
</p>
<form class="conclude" action="" method="post">
<table>
{{ form.as_table }}
<tr>
<td colspan="2" class="actions">
<a href="{% url group_charter acronym=wg.acronym %}">Back</a>
<input type="submit" value="Send request"/>
<a class="button" href="{% url group_charter acronym=wg.acronym %}">Cancel</a>
<input class="button" type="submit" value="Send request"/>
</td>
</tr>
</table>

View file

@ -51,14 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.ietf-concluded-warning { background:red;color:white;padding:2px 2px;}
.ietf-proposed-bg { }
.ietf-proposed-warning { background:green;color:white;padding:2px 2px;}
.ietf-box th {
font-weight: bold;
padding-top: 1em;
text-align: left;
}
.ietf-box tr:first-child th {
padding-top: 0;
}
.ietf-box th { font-weight: bold; padding-top: 1em; text-align: left; }
.ietf-box tr:first-child th { padding-top: 0; }
{% endblock morecss %}
{% block content %}
@ -73,7 +67,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<div>
<a {% if selected == "documents" %}class="selected"{% else %}href="{% url ietf.wginfo.views.group_documents acronym=group.acronym %}"{% endif %}>Documents</a> |
<a {% if selected == "charter" %}class="selected"{% else %}href="{% url ietf.wginfo.views.group_charter acronym=group.acronym %}"{% endif %}>Charter</a> |
<a {% if selected == "history" %}class="selected"{% else %}href="{% url ietf.wginfo.views.history acronym=group.acronym %}"{% endif %}>History</a> |
{% if group.list_archive|startswith:"http:" or group.list_archive|startswith:"https:" or group.list_archive|startswith:"ftp:" %}
<a href="{{ group.list_archive }}">List Archive &raquo;</a> |
@ -83,9 +76,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% if menu_actions %}
<div class="actions">
{% for name, url in menu_actions %}
{% for name, url in menu_actions %}
<a href="{{ url }}">{{ name }}</a>
{% endfor %}
{% endfor %}
</div>
{% endif %}
</div>

View file

@ -59,7 +59,7 @@ is occasionally incorrect.</span>
<td>Chair{{ group.chairs|pluralize }}:</td>
<td>
{% for chair in group.chairs %}
<a href="mailto:{{ chair.address }}">{{ chair.person.plain_name }} &lt;{{ chair.address }}&gt;</a><br/>
<a href="mailto:{{ chair.email.address }}">{{ chair.person.plain_name }} &lt;{{ chair.email.address }}&gt;</a><br/>
{% endfor %}
</td>
</tr>
@ -77,7 +77,7 @@ is occasionally incorrect.</span>
<td>Tech Advisor{{ group.techadvisors|pluralize }}:</td>
<td>
{% for techadvisor in group.techadvisors %}
<a href="mailto:{{ techadvisor.address }}">{{ techadvisor.person.plain_name }} &lt;{{ techadvisor.address }}&gt;</a><br/>
<a href="mailto:{{ techadvisor.email.address }}">{{ techadvisor.person.plain_name }} &lt;{{ techadvisor.email.address }}&gt;</a><br/>
{% endfor %}
</td>
</tr>
@ -88,7 +88,7 @@ is occasionally incorrect.</span>
<td>Editor{{ group.editors|pluralize }}:</td>
<td>
{% for editor in group.editors %}
<a href="mailto:{{ editor.address }}">{{ editor.person.plain_name }} &lt;{{ editor.address }}&gt;</a><br/>
<a href="mailto:{{ editor.email.address }}">{{ editor.person.plain_name }} &lt;{{ editor.email.address }}&gt;</a><br/>
{% endfor %}
</td>
</tr>
@ -99,7 +99,7 @@ is occasionally incorrect.</span>
<td>Secretar{{ group.secretaries|pluralize:"y,ies" }}:</td>
<td>
{% for secretary in group.secretaries %}
<a href="mailto:{{ secretary.address }}">{{ secretary.person.plain_name }} &lt;{{ secretary.address }}&gt;</a><br/>
<a href="mailto:{{ secretary.email.address }}">{{ secretary.person.plain_name }} &lt;{{ secretary.email.address }}&gt;</a><br/>
{% endfor %}
</td>
</tr>
@ -110,7 +110,7 @@ is occasionally incorrect.</span>
<td>Delegate{{ group.delegates|pluralize }}:</td>
<td>
{% for delegate in group.delegates %}
<a href="mailto:{{ delegate.address }}">{{ delegate.person.plain_name }} &lt;{{ delegate.address }}&gt;</a><br/>
<a href="mailto:{{ delegate.email.address }}">{{ delegate.person.plain_name }} &lt;{{ delegate.email.address }}&gt;</a><br/>
{% endfor %}
</td>
</tr>
@ -142,10 +142,10 @@ is occasionally incorrect.</span>
{% with group.groupurl_set.all as urls %}
{% if urls %}
<p>In addition to the charter maintained by the IETF Secretariat, there is additional information about this working group on the Web at:
{% for url in urls %}
<a href="{{ url.url }}">{{ url.name }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %}
<p>In addition to the charter maintained by the IETF Secretariat, there is additional information about this working group on the Web at:
{% for url in urls %}
<a href="{{ url.url }}">{{ url.name }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %}
</p>
{% endif %}
{% endwith %}

View file

@ -1,4 +1,4 @@
{% for chair in group.chairs %}{% if forloop.first %} Chair{{ forloop.revcounter|pluralize:": ,s:" }} {% else %} {% endif %}{{ chair.person.plain_name }} <{{ chair.address }}>
{% for chair in group.chairs %}{% if forloop.first %} Chair{{ forloop.revcounter|pluralize:": ,s:" }} {% else %} {% endif %}{{ chair.person.plain_name }} <{{ chair.email.address }}>
{% endfor %} WG Mail: {{ group.list_email }}
To Join: {{ group.list_subscribe }}
Archive: {{ group.list_archive }}

View file

@ -7,22 +7,22 @@
Current Status: {{ group.state.name }}
Chair{{ group.chairs|pluralize }}:
{% for chair in group.chairs %} {{ chair.person.name }} <{{chair.address}}>
{% for chair in group.chairs %} {{ chair.person.name }} <{{chair.email.address}}>
{% endfor %}
{{ group.area.name}} Directors:
{% for ad in group.area.ads %} {{ ad.person.plain_name }} <{{ ad }}>
{% for ad in group.area.ads %} {{ ad.person.plain_name }} <{{ ad.email.address }}>
{% endfor %}
{% if group.areadirector %} {{ group.area.name }} Advisor:
{{ group.areadirector.person.plain_name }} <{{ group.areadirector.address }}>
{% endif %}{% if group.techadvisors %}
Tech Advisor{{ group.techadvisors|pluralize }}:
{% for techadvisor in group.techadvisors %} {{ techadvisor.person.plain_name }} <{{ techadvisor.address }}>
{% for techadvisor in group.techadvisors %} {{ techadvisor.person.plain_name }} <{{ techadvisor.email.address }}>
{% endfor %}{% endif %}{% if group.editors %}
Editor{{ group.editors|pluralize }}:
{% for editor in group.editors %} {{ editor.person.plain_name }} <{{ editor.address}}>
{% for editor in group.editors %} {{ editor.person.plain_name }} <{{ editor.email.address }}>
{% endfor %}{% endif %}{% if group.secretaries %}
Secretar{{ group.secretaries|pluralize:"y,ies" }}:
{% for secretary in group.secretaries %} {{ secretary.person.plain_name }} <{{ secretary.address }}>
{% for secretary in group.secretaries %} {{ secretary.person.plain_name }} <{{ secretary.email.address }}>
{% endfor %}{% endif %}
Mailing Lists:
General Discussion: {{ group.list_email }}

View file

@ -41,22 +41,22 @@ from django.conf import settings
from django.core.urlresolvers import reverse as urlreverse
from ietf.doc.views_search import SearchForm, retrieve_search_results
from ietf.ipr.models import IprDetail
from ietf.group.models import Group, GroupURL
from ietf.group.models import Group, GroupURL, Role
from ietf.doc.models import State, DocAlias, RelatedDocument
from ietf.doc.utils import get_chartering_type
from ietf.person.models import Email
from ietf.group.utils import get_charter_text
from ietf.doc.templatetags.ietf_filters import clean_whitespace
from ietf.ietfauth.utils import has_role
def roles(group, role_name):
return Role.objects.filter(group=group, name=role_name).select_related("email", "person")
def fill_in_charter_info(group, include_drafts=False):
group.areadirector = group.ad.role_email("ad", group.parent) if group.ad else None
group.chairs = Email.objects.filter(role__group=group, role__name="chair").select_related("person")
group.techadvisors = Email.objects.filter(role__group=group, role__name="techadv").select_related("person")
group.editors = Email.objects.filter(role__group=group, role__name="editor").select_related("person")
group.secretaries = Email.objects.filter(role__group=group, role__name="secr").select_related("person")
group.chairs =roles(group, "chair")
group.techadvisors = roles(group, "techadv")
group.editors = roles(group, "editor")
group.secretaries = roles(group, "secr")
milestone_state = "charter" if group.state_id == "proposed" else "active"
group.milestones = group.groupmilestone_set.filter(state=milestone_state).order_by('due')
@ -77,19 +77,16 @@ def fill_in_charter_info(group, include_drafts=False):
a.rel = RelatedDocument.objects.filter(source=a.document).distinct()
a.invrel = RelatedDocument.objects.filter(target=a).distinct()
def extract_last_name(email):
return email.person.name_parts()[3]
def extract_group_chairs(group):
return sorted(Email.objects.filter(role__group=group, role__name="chair").select_related("person"), key=extract_last_name)
def extract_last_name(role):
return role.person.name_parts()[3]
def wg_summary_area(request):
areas = Group.objects.filter(type="area", state="active").order_by("name")
for area in areas:
area.ads = sorted(Email.objects.filter(role__group=area, role__name="ad").select_related("person"), key=extract_last_name)
area.ads = sorted(roles(area, "ad"), key=extract_last_name)
area.groups = Group.objects.filter(parent=area, type="wg", state="active").order_by("acronym")
for group in area.groups:
group.chairs = extract_group_chairs(group)
group.chairs = sorted(roles(group, "chair"), key=extract_last_name)
areas = [a for a in areas if a.groups]
@ -101,7 +98,7 @@ def wg_summary_acronym(request):
areas = Group.objects.filter(type="area", state="active").order_by("name")
groups = Group.objects.filter(type="wg", state="active").order_by("acronym").select_related("parent")
for group in groups:
group.chairs = extract_group_chairs(group)
group.chairs = sorted(roles(group, "chair"), key=extract_last_name)
return render_to_response('wginfo/1wg-summary-by-acronym.txt',
{ 'areas': areas,
'groups': groups },
@ -110,7 +107,7 @@ def wg_summary_acronym(request):
def wg_charters(request):
areas = Group.objects.filter(type="area", state="active").order_by("name")
for area in areas:
area.ads = sorted(Email.objects.filter(role__group=area, role__name="ad").select_related("person"), key=extract_last_name)
area.ads = sorted(roles(area, "ad"), key=extract_last_name)
area.groups = Group.objects.filter(parent=area, type="wg", state="active").order_by("name")
for group in area.groups:
fill_in_charter_info(group, include_drafts=True)
@ -123,7 +120,7 @@ def wg_charters_by_acronym(request):
areas = dict((a.id, a) for a in Group.objects.filter(type="area", state="active").order_by("name"))
for area in areas.itervalues():
area.ads = sorted(Email.objects.filter(role__group=area, role__name="ad").select_related("person"), key=extract_last_name)
area.ads = sorted(roles(area, "ad"), key=extract_last_name)
groups = Group.objects.filter(type="wg", state="active").exclude(parent=None).order_by("acronym")
for group in groups:
@ -137,20 +134,13 @@ def active_wgs(request):
areas = Group.objects.filter(type="area", state="active").order_by("name")
for area in areas:
# dig out information for template
area.ads = []
for e in Email.objects.filter(role__group=area, role__name="ad").select_related("person"):
e.incoming = False
area.ads.append(e)
area.ads = (list(sorted(roles(area, "ad"), key=extract_last_name))
+ list(sorted(roles(area, "pre-ad"), key=extract_last_name)))
for e in Email.objects.filter(role__group=area, role__name="pre-ad").select_related("person"):
e.incoming = True
area.ads.append(e)
area.ads.sort(key=lambda e: (e.incoming, extract_last_name(e)))
area.wgs = Group.objects.filter(parent=area, type="wg", state="active").order_by("acronym")
area.groups = Group.objects.filter(parent=area, type="wg", state="active").order_by("acronym")
area.urls = area.groupurl_set.all().order_by("name")
for wg in area.wgs:
wg.chairs = extract_group_chairs(wg)
for group in area.groups:
group.chairs = sorted(roles(group, "chair"), key=extract_last_name)
return render_to_response('wginfo/active_wgs.html', {'areas':areas}, RequestContext(request))
@ -275,7 +265,7 @@ def group_charter(request, acronym):
group = get_object_or_404(Group, type="wg", acronym=acronym)
fill_in_charter_info(group, include_drafts=False)
group.delegates = Email.objects.filter(role__group=group, role__name="delegate").select_related("person")
group.delegates = roles(group, "delegate")
e = group.latest_event(type__in=("changed_state", "requested_close",))
requested_close = group.state_id != "conclude" and e and e.type == "requested_close"