Skip to content

Commit 7cd0f0b

Browse files
committed
Add checkbox to send receipt to nominator.
See ietf-tools#913 ietf-tools#929 - Legacy-Id: 5547
1 parent 50dd5ba commit 7cd0f0b

3 files changed

Lines changed: 55 additions & 10 deletions

File tree

ietf/dbtemplate/fixtures/nomcom_templates.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ $position: Position</field>
9191
</field>
9292
<field to="group.group" name="group" rel="ManyToOneRel"><None></None></field>
9393
</object>
94-
<object pk="8" model="dbtemplate.dbtemplate">
94+
<object p="8" model="dbtemplate.dbtemplate">
9595
<field type="CharField" name="path">/nomcom/defaults/email/nomination_reminder.txt</field>
9696
<field type="CharField" name="title">Email sent to nominees asking them to accept (or decline) the nominations.</field>
9797
<field type="TextField" name="variables">$positions: Nomination positions</field>
@@ -107,4 +107,25 @@ If you accept, you will need to fill out a questionnaire. You will receive the
107107
Best regards,</field>
108108
<field to="group.group" name="group" rel="ManyToOneRel"><None></None></field>
109109
</object>
110+
<object p="9" model="dbtemplate.dbtemplate">
111+
<field type="CharField" name="path">/nomcom/defaults/email/nomination_receipt.txt</field>
112+
<field type="CharField" name="title">Email sent to nominator to get a confirmation mail containing feedback in cleartext</field>
113+
<field type="TextField" name="variables">$nominee: Full name of the nominee
114+
$position: Nomination position
115+
$comments: Candidate's Qualifications for the Position</field>
116+
<field to="name.dbtemplatetypename" name="type" rel="ManyToOneRel">plain</field>
117+
<field type="TextField" name="content">Hi,
118+
119+
Your nomination of $nominee for the position of
120+
$position has been received and registered.
121+
122+
The following comments have also been registered:
123+
124+
--------------------------------------------------------------------------
125+
$comments
126+
--------------------------------------------------------------------------
127+
128+
Thank you,</field>
129+
<field to="group.group" name="group" rel="ManyToOneRel"><None></None></field>
130+
</object>
110131
</django-objects>

ietf/nomcom/forms.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Position, Feedback
2222
from ietf.nomcom.utils import QUESTIONNAIRE_TEMPLATE, NOMINATION_EMAIL_TEMPLATE, \
2323
INEXISTENT_PERSON_TEMPLATE, NOMINEE_EMAIL_TEMPLATE, \
24-
get_user_email
24+
NOMINATION_RECEIPT_TEMPLATE, get_user_email
2525
from ietf.nomcom.decorators import member_required
2626

2727
ROLODEX_URL = getattr(settings, 'ROLODEX_URL', None)
@@ -284,10 +284,15 @@ def save(self):
284284

285285

286286
class NominateForm(BaseNomcomForm, forms.ModelForm):
287-
comments = forms.CharField(label='Comments', widget=forms.Textarea())
287+
comments = forms.CharField(label="Candidate's Qualifications for the Position:",
288+
widget=forms.Textarea())
289+
confirmation = forms.BooleanField(label='Email comments back to me as confirmation',
290+
help_text="If you want to get a confirmation mail containing your feedback in cleartext, \
291+
please check the 'email comments back to me as confirmation' box below.",
292+
required=False)
288293

289294
fieldsets = [('Candidate Nomination', ('position', 'candidate_name',
290-
'candidate_email', 'candidate_phone', 'comments'))]
295+
'candidate_email', 'candidate_phone', 'comments', 'confirmation'))]
291296

292297
def __init__(self, *args, **kwargs):
293298
self.nomcom = kwargs.pop('nomcom', None)
@@ -301,8 +306,13 @@ def __init__(self, *args, **kwargs):
301306
author = get_user_email(self.user)
302307
if author:
303308
self.fields['nominator_email'].initial = author.address
304-
self.fieldsets = [('Candidate Nomination', ('position',
305-
'nominator_email', 'candidate_name',
309+
help_text = """(Nomcom Chair/Member: please fill this in. Use your own email address if the person making the
310+
nomination wishes to be anonymous. The confirmation email will be sent to the address given here,
311+
and the address will also be captured as part of the registered nomination.)"""
312+
self.fields['nominator_email'].help_text = help_text
313+
self.fieldsets = [('Candidate Nomination', ('nominator_email',
314+
'position',
315+
'candidate_name',
306316
'candidate_email', 'candidate_phone',
307317
'comments'))]
308318

@@ -314,6 +324,7 @@ def save(self, commit=True):
314324
candidate_name = self.cleaned_data['candidate_name']
315325
position = self.cleaned_data['position']
316326
comments = self.cleaned_data['comments']
327+
confirmation = self.cleaned_data['confirmation']
317328
nomcom_template_path = '/nomcom/%s/' % self.nomcom.group.acronym
318329
nomcom_chair = self.nomcom.group.get_chair()
319330
nomcom_chair_mail = nomcom_chair and nomcom_chair.email.address or None
@@ -373,7 +384,7 @@ def save(self, commit=True):
373384
from_email = settings.NOMCOM_FROM_EMAIL
374385
to_email = email.address
375386
context = {'nominee': email.person.name,
376-
'position': position}
387+
'position': position.name}
377388
path = nomcom_template_path + NOMINEE_EMAIL_TEMPLATE
378389
send_mail(None, to_email, from_email, subject, path, context)
379390

@@ -384,7 +395,7 @@ def save(self, commit=True):
384395
from_email = settings.NOMCOM_FROM_EMAIL
385396
to_email = email.address
386397
context = {'nominee': email.person.name,
387-
'position': position}
398+
'position': position.name}
388399
path = '%s%d/%s' % (nomcom_template_path,
389400
position.id, QUESTIONNAIRE_TEMPLATE)
390401
send_mail(None, to_email, from_email, subject, path, context)
@@ -395,13 +406,24 @@ def save(self, commit=True):
395406
to_email = nomcom_chair_mail
396407
context = {'nominee': email.person.name,
397408
'nominee_email': email.address,
398-
'position': position}
409+
'position': position.name}
399410
if author:
400411
context.update({'nominator': author.person.name,
401412
'nominator_email': author.address})
402413
path = nomcom_template_path + NOMINATION_EMAIL_TEMPLATE
403414
send_mail(None, to_email, from_email, subject, path, context)
404415

416+
if confirmation or not self.public:
417+
if author:
418+
subject = 'Nomination Receipt'
419+
from_email = settings.NOMCOM_FROM_EMAIL
420+
to_email = author.address
421+
context = {'nominee': email.person.name,
422+
'comments': comments,
423+
'position': position.name}
424+
path = nomcom_template_path + NOMINATION_RECEIPT_TEMPLATE
425+
send_mail(None, to_email, from_email, subject, path, context)
426+
405427
return nomination
406428

407429
class Meta:

ietf/nomcom/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
NOMINEE_EMAIL_TEMPLATE = 'email/new_nominee.txt'
1616
NOMINATION_EMAIL_TEMPLATE = 'email/new_nomination.txt'
1717
NOMINEE_REMINDER_TEMPLATE = 'email/nomination_reminder.txt'
18+
NOMINATION_RECEIPT_TEMPLATE = 'email/nomination_receipt.txt'
1819
DEFAULT_NOMCOM_TEMPLATES = [HOME_TEMPLATE,
1920
INEXISTENT_PERSON_TEMPLATE,
2021
NOMINEE_EMAIL_TEMPLATE,
2122
NOMINATION_EMAIL_TEMPLATE,
22-
NOMINEE_REMINDER_TEMPLATE]
23+
NOMINEE_REMINDER_TEMPLATE,
24+
NOMINATION_RECEIPT_TEMPLATE]
2325

2426

2527
def get_nomcom_by_year(year):

0 commit comments

Comments
 (0)