Skip to content

Commit 4d5de5d

Browse files
committed
Allow a nomcom to show nominees that have accepted nomination before feedback is open. Fixes ietf-tools#2598. Commit ready for merge.
- Legacy-Id: 15486
1 parent a966413 commit 4d5de5d

File tree

8 files changed

+96
-11
lines changed

8 files changed

+96
-11
lines changed

ietf/nomcom/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __init__(self, *args, **kwargs):
9999

100100
class Meta:
101101
model = NomCom
102-
fields = ('public_key', 'initial_text', 'show_nominee_pictures',
102+
fields = ('public_key', 'initial_text', 'show_nominee_pictures', 'show_accepted_nominees',
103103
'send_questionnaire', 'reminder_interval')
104104
widgets = {'public_key':FileInput, }
105105

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.15 on 2018-09-26 11:10
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('nomcom', '0002_auto_20180918_0550'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='nomcom',
17+
name='show_accepted_nominees',
18+
field=models.BooleanField(default=True, help_text=b'Show accepted nominees on the public nomination page', verbose_name=b'Show accepted nominees'),
19+
),
20+
]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.15 on 2018-09-26 11:12
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations
6+
7+
def forward(apps, schema_editor):
8+
NomCom = apps.get_model('nomcom','NomCom')
9+
NomCom.objects.update(show_accepted_nominees=False)
10+
11+
def reverse(apps, schema_editor):
12+
pass
13+
14+
class Migration(migrations.Migration):
15+
16+
dependencies = [
17+
('nomcom', '0003_nomcom_show_accepted_nominees'),
18+
]
19+
20+
operations = [
21+
migrations.RunPython(forward,reverse)
22+
]
23+

ietf/nomcom/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class NomCom(models.Model):
5151
blank=True)
5252
show_nominee_pictures = models.BooleanField(verbose_name='Show nominee pictures', default=True,
5353
help_text='Display pictures of each nominee (if available) on the feedback pages')
54+
show_accepted_nominees = models.BooleanField(verbose_name='Show accepted nominees', default=True,
55+
help_text='Show accepted nominees on the public nomination page')
5456

5557
class Meta:
5658
verbose_name_plural = 'NomComs'

ietf/nomcom/resources.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class Meta:
2424
"send_questionnaire": ALL,
2525
"reminder_interval": ALL,
2626
"initial_text": ALL,
27+
"show_nominee_pictures": ALL,
28+
"show_accepted_nominees": ALL,
2729
"group": ALL_WITH_RELATIONS,
2830
}
2931
api.nomcom.register(NomComResource())

ietf/nomcom/tests.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,6 +1941,27 @@ def test_feedback_pictures(self):
19411941
q = PyQuery(response.content)
19421942
self.assertFalse(q('.photo'))
19431943

1944+
class ShowNomineeTests(TestCase):
1945+
def setUp(self):
1946+
build_test_public_keys_dir(self)
1947+
self.nc = NomComFactory(**nomcom_kwargs_for_year())
1948+
self.plain_person = PersonFactory.create()
1949+
1950+
def tearDown(self):
1951+
clean_test_public_keys_dir(self)
1952+
1953+
def test_feedback_pictures(self):
1954+
url = reverse('ietf.nomcom.views.public_nominate',kwargs={'year':self.nc.year()})
1955+
login_testing_unauthorized(self,self.plain_person.user.username,url)
1956+
response = self.client.get(url)
1957+
q = PyQuery(response.content)
1958+
self.assertTrue(q('h3'))
1959+
self.nc.show_accepted_nominees=False;
1960+
self.nc.save()
1961+
response = self.client.get(url)
1962+
q = PyQuery(response.content)
1963+
self.assertFalse(q('h3'))
1964+
19441965
class TopicTests(TestCase):
19451966
def setUp(self):
19461967
build_test_public_keys_dir(self)

ietf/nomcom/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ def nominate(request, year, public, newperson):
424424
{'form': form,
425425
'nomcom': nomcom,
426426
'year': year,
427+
'positions': nomcom.position_set.filter(is_open=True),
427428
'selected': 'nominate'})
428429

429430
@login_required

ietf/templates/nomcom/public_nominate.html

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,32 @@
1616
{% block nomcom_content %}
1717
{% origin %}
1818

19-
{% if form %}
20-
<form id="nominate-form" method="post">
21-
{% csrf_token %}
22-
{% bootstrap_form form %}
23-
{% buttons %}
24-
<button class="btn btn-primary" type="submit" name="save" value="Save">Save</button>
25-
{% endbuttons %}
26-
</form>
27-
{% endif %}
28-
19+
<div class="row">
20+
<div class="col-sm-9">
21+
{% if form %}
22+
<form id="nominate-form" method="post">
23+
{% csrf_token %}
24+
{% bootstrap_form form %}
25+
{% buttons %}
26+
<button class="btn btn-primary" type="submit" name="save" value="Save">Save</button>
27+
{% endbuttons %}
28+
</form>
29+
{% endif %}
30+
</div>
31+
<div class="col-sm-3">
32+
{% if nomcom.show_accepted_nominees %}
33+
<h3>Nominees<br><small>who have accepted nomination</small></h3>
34+
{% for p in positions %}
35+
{% if p.nomineeposition_set.accepted.not_duplicated %}
36+
<h4>{{ p.name }}</h4>
37+
{% for np in p.nomineeposition_set.accepted.not_duplicated %}
38+
<div class="col-sm-offset-1">{{ np.nominee.name }}</div>
39+
{% endfor %}
40+
{% endif %}
41+
{% endfor %}
42+
{% endif %}
43+
</div>
44+
</div>
2945
{% endblock %}
3046

3147
{% block js %}

0 commit comments

Comments
 (0)