Merged in [15486] from rjsparks@nostrum.com:
Allow a nomcom to show nominees that have accepted nomination before feedback is open. Fixes #2598.
- Legacy-Id: 15487
Note: SVN reference [15486] has been migrated to Git commit 4d5de5dee6
This commit is contained in:
commit
29ae7809d7
|
@ -99,7 +99,7 @@ class EditNomcomForm(forms.ModelForm):
|
|||
|
||||
class Meta:
|
||||
model = NomCom
|
||||
fields = ('public_key', 'initial_text', 'show_nominee_pictures',
|
||||
fields = ('public_key', 'initial_text', 'show_nominee_pictures', 'show_accepted_nominees',
|
||||
'send_questionnaire', 'reminder_interval')
|
||||
widgets = {'public_key':FileInput, }
|
||||
|
||||
|
|
20
ietf/nomcom/migrations/0003_nomcom_show_accepted_nominees.py
Normal file
20
ietf/nomcom/migrations/0003_nomcom_show_accepted_nominees.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.15 on 2018-09-26 11:10
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('nomcom', '0002_auto_20180918_0550'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='nomcom',
|
||||
name='show_accepted_nominees',
|
||||
field=models.BooleanField(default=True, help_text=b'Show accepted nominees on the public nomination page', verbose_name=b'Show accepted nominees'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.15 on 2018-09-26 11:12
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
def forward(apps, schema_editor):
|
||||
NomCom = apps.get_model('nomcom','NomCom')
|
||||
NomCom.objects.update(show_accepted_nominees=False)
|
||||
|
||||
def reverse(apps, schema_editor):
|
||||
pass
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('nomcom', '0003_nomcom_show_accepted_nominees'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(forward,reverse)
|
||||
]
|
||||
|
|
@ -51,6 +51,8 @@ class NomCom(models.Model):
|
|||
blank=True)
|
||||
show_nominee_pictures = models.BooleanField(verbose_name='Show nominee pictures', default=True,
|
||||
help_text='Display pictures of each nominee (if available) on the feedback pages')
|
||||
show_accepted_nominees = models.BooleanField(verbose_name='Show accepted nominees', default=True,
|
||||
help_text='Show accepted nominees on the public nomination page')
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = 'NomComs'
|
||||
|
|
|
@ -24,6 +24,8 @@ class NomComResource(ModelResource):
|
|||
"send_questionnaire": ALL,
|
||||
"reminder_interval": ALL,
|
||||
"initial_text": ALL,
|
||||
"show_nominee_pictures": ALL,
|
||||
"show_accepted_nominees": ALL,
|
||||
"group": ALL_WITH_RELATIONS,
|
||||
}
|
||||
api.nomcom.register(NomComResource())
|
||||
|
|
|
@ -1941,6 +1941,27 @@ class FeedbackPictureTests(TestCase):
|
|||
q = PyQuery(response.content)
|
||||
self.assertFalse(q('.photo'))
|
||||
|
||||
class ShowNomineeTests(TestCase):
|
||||
def setUp(self):
|
||||
build_test_public_keys_dir(self)
|
||||
self.nc = NomComFactory(**nomcom_kwargs_for_year())
|
||||
self.plain_person = PersonFactory.create()
|
||||
|
||||
def tearDown(self):
|
||||
clean_test_public_keys_dir(self)
|
||||
|
||||
def test_feedback_pictures(self):
|
||||
url = reverse('ietf.nomcom.views.public_nominate',kwargs={'year':self.nc.year()})
|
||||
login_testing_unauthorized(self,self.plain_person.user.username,url)
|
||||
response = self.client.get(url)
|
||||
q = PyQuery(response.content)
|
||||
self.assertTrue(q('h3'))
|
||||
self.nc.show_accepted_nominees=False;
|
||||
self.nc.save()
|
||||
response = self.client.get(url)
|
||||
q = PyQuery(response.content)
|
||||
self.assertFalse(q('h3'))
|
||||
|
||||
class TopicTests(TestCase):
|
||||
def setUp(self):
|
||||
build_test_public_keys_dir(self)
|
||||
|
|
|
@ -424,6 +424,7 @@ def nominate(request, year, public, newperson):
|
|||
{'form': form,
|
||||
'nomcom': nomcom,
|
||||
'year': year,
|
||||
'positions': nomcom.position_set.filter(is_open=True),
|
||||
'selected': 'nominate'})
|
||||
|
||||
@login_required
|
||||
|
|
|
@ -16,16 +16,32 @@
|
|||
{% block nomcom_content %}
|
||||
{% origin %}
|
||||
|
||||
{% if form %}
|
||||
<form id="nominate-form" method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons %}
|
||||
<button class="btn btn-primary" type="submit" name="save" value="Save">Save</button>
|
||||
{% endbuttons %}
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
{% if form %}
|
||||
<form id="nominate-form" method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons %}
|
||||
<button class="btn btn-primary" type="submit" name="save" value="Save">Save</button>
|
||||
{% endbuttons %}
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
{% if nomcom.show_accepted_nominees %}
|
||||
<h3>Nominees<br><small>who have accepted nomination</small></h3>
|
||||
{% for p in positions %}
|
||||
{% if p.nomineeposition_set.accepted.not_duplicated %}
|
||||
<h4>{{ p.name }}</h4>
|
||||
{% for np in p.nomineeposition_set.accepted.not_duplicated %}
|
||||
<div class="col-sm-offset-1">{{ np.nominee.name }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue