Skip to content

Commit 3701f2a

Browse files
committed
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
1 parent c419271 commit 3701f2a

8 files changed

Lines changed: 69 additions & 88 deletions

File tree

ietf/templates/wginfo/1wg-summary.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{% for area in areas %}{{ area.name }} ({{ area.acronym }})
66
{{ area.name|dashify }}------{% for ad in area.ads %}
7-
{{ ad.person }} <{{ ad.address }}>{% endfor %}
7+
{{ ad.person.plain_name }} <{{ ad.email.address }}>{% endfor %}
88

99
{% for group in area.groups %}{{ group.name }} ({{ group.acronym }})
1010
{% include "wginfo/group_entry.txt" %}

ietf/templates/wginfo/active_wgs.html

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,47 +53,44 @@ <h1>Active IETF Working Groups</h1>
5353
{% for area in areas %}
5454
<h2 class="ietf-divider" id="{{area.name|cut:" "}}">{{ area.name }}</h2>
5555

56-
{% for ad in area.ads %}
57-
{% if forloop.first %}
58-
<p>Area Director{{ forloop.revcounter|pluralize }}:</p>
56+
{% if area.ads %}
57+
<p>Area Director{{ area.ads|pluralize }}:</p>
5958
<table style="margin-left: 2em" class="ietf-wg-table">
60-
{% endif %}
61-
<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>
62-
{% if forloop.last %}
59+
{% for ad in area.ads %}
60+
<tr>
61+
<td><span class="square bgcolor{{forloop.counter}}">&nbsp;</span></td>
62+
<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>
63+
</tr>
64+
{% endfor %}
6365
</table>
6466
{% endif %}
65-
{% endfor %}
6667

67-
{% for url in area.urls %}
68-
{% if forloop.first %}
69-
<p>Area Specific Web Page{{ forloop.revcounter|pluralize}}:</p>
68+
{% if area.urls %}
69+
<p>Area Specific Web Page{{ area.urls|pluralize}}:</p>
7070
<p style="margin-left: 2em">
71-
{% endif %}
71+
{% for url in area.urls %}
7272
<a href="{{ url.url }}">{{ url.name }}</a>{% if not forloop.last %}<br/>{% endif %}
73-
{% if forloop.last %}
73+
{% endfor %}
7474
</p>
7575
{% endif %}
76-
{% endfor %}
7776

78-
{% for wg in area.wgs %}
79-
{% if forloop.first %}
80-
<p>Active Working Groups:</p>
77+
{% if area.groups %}
78+
<p>Active Working Group{{ area.groups|pluralize}}:</p>
8179
<div style="margin-left:2em;">
8280
<table class="ietf-wg-table">
83-
{% endif %}
81+
{% for group in area.groups %}
8482
<tr>
85-
<td width="10%;"><a href="/wg/{{ wg.acronym }}/">{{ wg.acronym }}</a></td>
86-
<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>
87-
<td width="50%">{{ wg.name }}</td>
88-
<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>
83+
<td width="10%;"><a href="/wg/{{ group.acronym }}/">{{ group.acronym }}</a></td>
84+
<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>
85+
<td width="50%">{{ group.name }}</td>
86+
<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>
8987
</tr>
90-
{% if forloop.last %}
88+
{% endfor %}
9189
</table>
9290
</div>
93-
{% endif %}
94-
{% empty %}
91+
{% else %}
9592
<p>No Active Working Groups</p>
96-
{% endfor %}{# wg #}
93+
{% endif %}
9794

9895
{% endfor %}{# area #}
9996

ietf/templates/wginfo/conclude.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends "base.html" %}
22

3-
{% block title %}Request closing of WG {{ wg.acronym }}{% endblock %}
3+
{% block title %}Request closing of {{ wg.acronym }} {{ wg.type.name }}{% endblock %}
44

55
{% block morecss %}
66
#id_instructions {
@@ -14,22 +14,23 @@
1414
{% endblock %}
1515

1616
{% block content %}
17-
<h1>Request closing of {{ wg.acronym }}</h1>
17+
<h1>Request closing of {{ wg.acronym }} {{ wg.type.name }}</h1>
1818

1919
<p>
2020
Please provide instructions regarding the disposition of each
2121
active Internet-Draft (such as to withdraw the draft, move it to
22-
another WG, convert it to an individual submission, and so on),
23-
wording for the closure announcement, and the status of the WG
22+
another group, convert it to an individual submission, and so on),
23+
wording for the closure announcement, and the status of the group
2424
mailing list (will it remain open or should it be closed).
2525
</p>
26+
2627
<form class="conclude" action="" method="post">
2728
<table>
2829
{{ form.as_table }}
2930
<tr>
3031
<td colspan="2" class="actions">
31-
<a href="{% url group_charter acronym=wg.acronym %}">Back</a>
32-
<input type="submit" value="Send request"/>
32+
<a class="button" href="{% url group_charter acronym=wg.acronym %}">Cancel</a>
33+
<input class="button" type="submit" value="Send request"/>
3334
</td>
3435
</tr>
3536
</table>

ietf/templates/wginfo/group_base.html

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,8 @@
5151
.ietf-concluded-warning { background:red;color:white;padding:2px 2px;}
5252
.ietf-proposed-bg { }
5353
.ietf-proposed-warning { background:green;color:white;padding:2px 2px;}
54-
.ietf-box th {
55-
font-weight: bold;
56-
padding-top: 1em;
57-
text-align: left;
58-
}
59-
.ietf-box tr:first-child th {
60-
padding-top: 0;
61-
}
54+
.ietf-box th { font-weight: bold; padding-top: 1em; text-align: left; }
55+
.ietf-box tr:first-child th { padding-top: 0; }
6256
{% endblock morecss %}
6357

6458
{% block content %}
@@ -73,7 +67,6 @@ <h1>{{ group.name}} ({{ group.acronym }})
7367
<div>
7468
<a {% if selected == "documents" %}class="selected"{% else %}href="{% url ietf.wginfo.views.group_documents acronym=group.acronym %}"{% endif %}>Documents</a> |
7569
<a {% if selected == "charter" %}class="selected"{% else %}href="{% url ietf.wginfo.views.group_charter acronym=group.acronym %}"{% endif %}>Charter</a> |
76-
7770
<a {% if selected == "history" %}class="selected"{% else %}href="{% url ietf.wginfo.views.history acronym=group.acronym %}"{% endif %}>History</a> |
7871
{% if group.list_archive|startswith:"http:" or group.list_archive|startswith:"https:" or group.list_archive|startswith:"ftp:" %}
7972
<a href="{{ group.list_archive }}">List Archive &raquo;</a> |
@@ -83,9 +76,9 @@ <h1>{{ group.name}} ({{ group.acronym }})
8376

8477
{% if menu_actions %}
8578
<div class="actions">
86-
{% for name, url in menu_actions %}
79+
{% for name, url in menu_actions %}
8780
<a href="{{ url }}">{{ name }}</a>
88-
{% endfor %}
81+
{% endfor %}
8982
</div>
9083
{% endif %}
9184
</div>

ietf/templates/wginfo/group_charter.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<td>Chair{{ group.chairs|pluralize }}:</td>
6060
<td>
6161
{% for chair in group.chairs %}
62-
<a href="mailto:{{ chair.address }}">{{ chair.person.plain_name }} &lt;{{ chair.address }}&gt;</a><br/>
62+
<a href="mailto:{{ chair.email.address }}">{{ chair.person.plain_name }} &lt;{{ chair.email.address }}&gt;</a><br/>
6363
{% endfor %}
6464
</td>
6565
</tr>
@@ -77,7 +77,7 @@
7777
<td>Tech Advisor{{ group.techadvisors|pluralize }}:</td>
7878
<td>
7979
{% for techadvisor in group.techadvisors %}
80-
<a href="mailto:{{ techadvisor.address }}">{{ techadvisor.person.plain_name }} &lt;{{ techadvisor.address }}&gt;</a><br/>
80+
<a href="mailto:{{ techadvisor.email.address }}">{{ techadvisor.person.plain_name }} &lt;{{ techadvisor.email.address }}&gt;</a><br/>
8181
{% endfor %}
8282
</td>
8383
</tr>
@@ -88,7 +88,7 @@
8888
<td>Editor{{ group.editors|pluralize }}:</td>
8989
<td>
9090
{% for editor in group.editors %}
91-
<a href="mailto:{{ editor.address }}">{{ editor.person.plain_name }} &lt;{{ editor.address }}&gt;</a><br/>
91+
<a href="mailto:{{ editor.email.address }}">{{ editor.person.plain_name }} &lt;{{ editor.email.address }}&gt;</a><br/>
9292
{% endfor %}
9393
</td>
9494
</tr>
@@ -99,7 +99,7 @@
9999
<td>Secretar{{ group.secretaries|pluralize:"y,ies" }}:</td>
100100
<td>
101101
{% for secretary in group.secretaries %}
102-
<a href="mailto:{{ secretary.address }}">{{ secretary.person.plain_name }} &lt;{{ secretary.address }}&gt;</a><br/>
102+
<a href="mailto:{{ secretary.email.address }}">{{ secretary.person.plain_name }} &lt;{{ secretary.email.address }}&gt;</a><br/>
103103
{% endfor %}
104104
</td>
105105
</tr>
@@ -110,7 +110,7 @@
110110
<td>Delegate{{ group.delegates|pluralize }}:</td>
111111
<td>
112112
{% for delegate in group.delegates %}
113-
<a href="mailto:{{ delegate.address }}">{{ delegate.person.plain_name }} &lt;{{ delegate.address }}&gt;</a><br/>
113+
<a href="mailto:{{ delegate.email.address }}">{{ delegate.person.plain_name }} &lt;{{ delegate.email.address }}&gt;</a><br/>
114114
{% endfor %}
115115
</td>
116116
</tr>
@@ -142,10 +142,10 @@
142142

143143
{% with group.groupurl_set.all as urls %}
144144
{% if urls %}
145-
<p>In addition to the charter maintained by the IETF Secretariat, there is additional information about this working group on the Web at:
146-
{% for url in urls %}
147-
<a href="{{ url.url }}">{{ url.name }}</a>{% if not forloop.last %}, {% endif %}
148-
{% endfor %}
145+
<p>In addition to the charter maintained by the IETF Secretariat, there is additional information about this working group on the Web at:
146+
{% for url in urls %}
147+
<a href="{{ url.url }}">{{ url.name }}</a>{% if not forloop.last %}, {% endif %}
148+
{% endfor %}
149149
</p>
150150
{% endif %}
151151
{% endwith %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% for chair in group.chairs %}{% if forloop.first %} Chair{{ forloop.revcounter|pluralize:": ,s:" }} {% else %} {% endif %}{{ chair.person.plain_name }} <{{ chair.address }}>
1+
{% for chair in group.chairs %}{% if forloop.first %} Chair{{ forloop.revcounter|pluralize:": ,s:" }} {% else %} {% endif %}{{ chair.person.plain_name }} <{{ chair.email.address }}>
22
{% endfor %} WG Mail: {{ group.list_email }}
33
To Join: {{ group.list_subscribe }}
44
Archive: {{ group.list_archive }}

ietf/templates/wginfo/group_entry_with_charter.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
Current Status: {{ group.state.name }}
88

99
Chair{{ group.chairs|pluralize }}:
10-
{% for chair in group.chairs %} {{ chair.person.name }} <{{chair.address}}>
10+
{% for chair in group.chairs %} {{ chair.person.name }} <{{chair.email.address}}>
1111
{% endfor %}
1212
{{ group.area.name}} Directors:
13-
{% for ad in group.area.ads %} {{ ad.person.plain_name }} <{{ ad }}>
13+
{% for ad in group.area.ads %} {{ ad.person.plain_name }} <{{ ad.email.address }}>
1414
{% endfor %}
1515
{% if group.areadirector %} {{ group.area.name }} Advisor:
1616
{{ group.areadirector.person.plain_name }} <{{ group.areadirector.address }}>
1717
{% endif %}{% if group.techadvisors %}
1818
Tech Advisor{{ group.techadvisors|pluralize }}:
19-
{% for techadvisor in group.techadvisors %} {{ techadvisor.person.plain_name }} <{{ techadvisor.address }}>
19+
{% for techadvisor in group.techadvisors %} {{ techadvisor.person.plain_name }} <{{ techadvisor.email.address }}>
2020
{% endfor %}{% endif %}{% if group.editors %}
2121
Editor{{ group.editors|pluralize }}:
22-
{% for editor in group.editors %} {{ editor.person.plain_name }} <{{ editor.address}}>
22+
{% for editor in group.editors %} {{ editor.person.plain_name }} <{{ editor.email.address }}>
2323
{% endfor %}{% endif %}{% if group.secretaries %}
2424
Secretar{{ group.secretaries|pluralize:"y,ies" }}:
25-
{% for secretary in group.secretaries %} {{ secretary.person.plain_name }} <{{ secretary.address }}>
25+
{% for secretary in group.secretaries %} {{ secretary.person.plain_name }} <{{ secretary.email.address }}>
2626
{% endfor %}{% endif %}
2727
Mailing Lists:
2828
General Discussion: {{ group.list_email }}

ietf/wginfo/views.py

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,22 @@
4141
from django.core.urlresolvers import reverse as urlreverse
4242

4343
from ietf.doc.views_search import SearchForm, retrieve_search_results
44-
from ietf.ipr.models import IprDetail
45-
from ietf.group.models import Group, GroupURL
44+
from ietf.group.models import Group, GroupURL, Role
4645
from ietf.doc.models import State, DocAlias, RelatedDocument
4746
from ietf.doc.utils import get_chartering_type
48-
from ietf.person.models import Email
4947
from ietf.group.utils import get_charter_text
5048
from ietf.doc.templatetags.ietf_filters import clean_whitespace
5149
from ietf.ietfauth.utils import has_role
5250

51+
def roles(group, role_name):
52+
return Role.objects.filter(group=group, name=role_name).select_related("email", "person")
5353

5454
def fill_in_charter_info(group, include_drafts=False):
5555
group.areadirector = group.ad.role_email("ad", group.parent) if group.ad else None
56-
group.chairs = Email.objects.filter(role__group=group, role__name="chair").select_related("person")
57-
group.techadvisors = Email.objects.filter(role__group=group, role__name="techadv").select_related("person")
58-
group.editors = Email.objects.filter(role__group=group, role__name="editor").select_related("person")
59-
group.secretaries = Email.objects.filter(role__group=group, role__name="secr").select_related("person")
56+
group.chairs =roles(group, "chair")
57+
group.techadvisors = roles(group, "techadv")
58+
group.editors = roles(group, "editor")
59+
group.secretaries = roles(group, "secr")
6060
milestone_state = "charter" if group.state_id == "proposed" else "active"
6161
group.milestones = group.groupmilestone_set.filter(state=milestone_state).order_by('due')
6262

@@ -77,19 +77,16 @@ def fill_in_charter_info(group, include_drafts=False):
7777
a.rel = RelatedDocument.objects.filter(source=a.document).distinct()
7878
a.invrel = RelatedDocument.objects.filter(target=a).distinct()
7979

80-
def extract_last_name(email):
81-
return email.person.name_parts()[3]
82-
83-
def extract_group_chairs(group):
84-
return sorted(Email.objects.filter(role__group=group, role__name="chair").select_related("person"), key=extract_last_name)
80+
def extract_last_name(role):
81+
return role.person.name_parts()[3]
8582

8683
def wg_summary_area(request):
8784
areas = Group.objects.filter(type="area", state="active").order_by("name")
8885
for area in areas:
89-
area.ads = sorted(Email.objects.filter(role__group=area, role__name="ad").select_related("person"), key=extract_last_name)
86+
area.ads = sorted(roles(area, "ad"), key=extract_last_name)
9087
area.groups = Group.objects.filter(parent=area, type="wg", state="active").order_by("acronym")
9188
for group in area.groups:
92-
group.chairs = extract_group_chairs(group)
89+
group.chairs = sorted(roles(group, "chair"), key=extract_last_name)
9390

9491
areas = [a for a in areas if a.groups]
9592

@@ -101,7 +98,7 @@ def wg_summary_acronym(request):
10198
areas = Group.objects.filter(type="area", state="active").order_by("name")
10299
groups = Group.objects.filter(type="wg", state="active").order_by("acronym").select_related("parent")
103100
for group in groups:
104-
group.chairs = extract_group_chairs(group)
101+
group.chairs = sorted(roles(group, "chair"), key=extract_last_name)
105102
return render_to_response('wginfo/1wg-summary-by-acronym.txt',
106103
{ 'areas': areas,
107104
'groups': groups },
@@ -110,7 +107,7 @@ def wg_summary_acronym(request):
110107
def wg_charters(request):
111108
areas = Group.objects.filter(type="area", state="active").order_by("name")
112109
for area in areas:
113-
area.ads = sorted(Email.objects.filter(role__group=area, role__name="ad").select_related("person"), key=extract_last_name)
110+
area.ads = sorted(roles(area, "ad"), key=extract_last_name)
114111
area.groups = Group.objects.filter(parent=area, type="wg", state="active").order_by("name")
115112
for group in area.groups:
116113
fill_in_charter_info(group, include_drafts=True)
@@ -123,7 +120,7 @@ def wg_charters_by_acronym(request):
123120
areas = dict((a.id, a) for a in Group.objects.filter(type="area", state="active").order_by("name"))
124121

125122
for area in areas.itervalues():
126-
area.ads = sorted(Email.objects.filter(role__group=area, role__name="ad").select_related("person"), key=extract_last_name)
123+
area.ads = sorted(roles(area, "ad"), key=extract_last_name)
127124

128125
groups = Group.objects.filter(type="wg", state="active").exclude(parent=None).order_by("acronym")
129126
for group in groups:
@@ -137,20 +134,13 @@ def active_wgs(request):
137134
areas = Group.objects.filter(type="area", state="active").order_by("name")
138135
for area in areas:
139136
# dig out information for template
140-
area.ads = []
141-
for e in Email.objects.filter(role__group=area, role__name="ad").select_related("person"):
142-
e.incoming = False
143-
area.ads.append(e)
144-
145-
for e in Email.objects.filter(role__group=area, role__name="pre-ad").select_related("person"):
146-
e.incoming = True
147-
area.ads.append(e)
137+
area.ads = (list(sorted(roles(area, "ad"), key=extract_last_name))
138+
+ list(sorted(roles(area, "pre-ad"), key=extract_last_name)))
148139

149-
area.ads.sort(key=lambda e: (e.incoming, extract_last_name(e)))
150-
area.wgs = Group.objects.filter(parent=area, type="wg", state="active").order_by("acronym")
140+
area.groups = Group.objects.filter(parent=area, type="wg", state="active").order_by("acronym")
151141
area.urls = area.groupurl_set.all().order_by("name")
152-
for wg in area.wgs:
153-
wg.chairs = extract_group_chairs(wg)
142+
for group in area.groups:
143+
group.chairs = sorted(roles(group, "chair"), key=extract_last_name)
154144

155145
return render_to_response('wginfo/active_wgs.html', {'areas':areas}, RequestContext(request))
156146

@@ -275,7 +265,7 @@ def group_charter(request, acronym):
275265
group = get_object_or_404(Group, type="wg", acronym=acronym)
276266

277267
fill_in_charter_info(group, include_drafts=False)
278-
group.delegates = Email.objects.filter(role__group=group, role__name="delegate").select_related("person")
268+
group.delegates = roles(group, "delegate")
279269

280270
e = group.latest_event(type__in=("changed_state", "requested_close",))
281271
requested_close = group.state_id != "conclude" and e and e.type == "requested_close"

0 commit comments

Comments
 (0)