now reminder form sends accept and decline links, and questionnaires.

See #1040
 - Legacy-Id: 5735
This commit is contained in:
Emilio Jiménez 2013-05-15 07:24:32 +00:00
parent 7042e8896a
commit 3d25fa261e
2 changed files with 42 additions and 11 deletions

View file

@ -103,11 +103,13 @@ $position: Position</field>
<field to="name.dbtemplatetypename" name="type" rel="ManyToOneRel">plain</field>
<field type="TextField" name="content">Hi,
You have been nominated for the positions: $positions
You have been nominated for the position of $position.
The NomCom would appreciate receiving an indication of whether or not you accept this nomination to stand for consideration as a candidate for these positions.
The NomCom would appreciate receiving an indication of whether or not you accept this nomination to stand for consideration as a candidate for this position.
If you accept, you will need to fill out a questionnaire. You will receive the questionnaire by email
You can accept the nomination via web going to the following link http://$domain$accept_url or decline the nomination going the following link http://$domain$decline_url
If you accept, you will need to fill out a questionnaire.
Best regards,</field>
<field to="group.group" name="group" rel="ManyToOneRel"><None></None></field>
@ -116,8 +118,10 @@ Best regards,</field>
<field type="CharField" name="path">/nomcom/defaults/email/nomination_receipt.txt</field>
<field type="CharField" name="title">Email sent to nominator to get a confirmation mail containing feedback in cleartext</field>
<field type="TextField" name="variables">$nominee: Full name of the nominee
$position: Nomination position
$comments: Candidate's Qualifications for the Position</field>
$position: Name of the position
$domain: Server domain
$accept_url: Url hash to accept nominations
$decline_url: Url hash to decline nominations</field>
<field to="name.dbtemplatetypename" name="type" rel="ManyToOneRel">plain</field>
<field type="TextField" name="content">Hi,

View file

@ -12,8 +12,9 @@ from django.template.loader import render_to_string
from django.utils import simplejson
from django.db.models import Count, Q
from django.forms.models import modelformset_factory, inlineformset_factory
from django.contrib.sites.models import Site
from ietf.utils.mail import send_mail
from ietf.utils.mail import send_mail_text
from ietf.dbtemplate.models import DBTemplate
from ietf.dbtemplate.views import template_edit
@ -25,9 +26,9 @@ from ietf.nomcom.forms import (NominateForm, FeedbackForm, QuestionnaireForm,
PrivateKeyForm, EditNomcomForm, PendingFeedbackForm,
ReminderDatesForm)
from ietf.nomcom.models import Position, NomineePosition, Nominee, Feedback, NomCom, ReminderDates
from ietf.nomcom.utils import (get_nomcom_by_year, HOME_TEMPLATE,
from ietf.nomcom.utils import (get_nomcom_by_year, get_year_by_nomcom, HOME_TEMPLATE,
store_nomcom_private_key, get_hash_nominee_position,
NOMINEE_REMINDER_TEMPLATE)
NOMINEE_REMINDER_TEMPLATE, QUESTIONNAIRE_TEMPLATE)
def index(request, year):
@ -149,11 +150,37 @@ def send_reminder_mail(request, year):
if selected_nominees:
subject = 'IETF Nomination Information'
from_email = settings.NOMCOM_FROM_EMAIL
domain = Site.objects.get_current().domain
today = datetime.date.today().strftime('%Y%m%d')
for nominee in nominees:
to_email = nominee.email.address
positions = ', '.join([nominee_position.position.name for nominee_position in nominee.nomineeposition_set.pending()])
context = {'positions': positions}
send_mail(None, to_email, from_email, subject, mail_path, context)
for nominee_position in nominee.nomineeposition_set.pending():
hash = get_hash_nominee_position(today, nominee_position.id)
accept_url = reverse('nomcom_process_nomination_status',
None,
args=(get_year_by_nomcom(nomcom),
nominee_position.id,
'accepted',
today,
hash))
decline_url = reverse('nomcom_process_nomination_status',
None,
args=(get_year_by_nomcom(nomcom),
nominee_position.id,
'declined',
today,
hash))
context = {'nominee': nominee,
'position': nominee_position.position,
'domain': domain,
'accept_url': accept_url,
'decline_url': decline_url}
body = render_to_string(mail_path, context)
path = '%s%d/%s' % (nomcom_template_path, nominee_position.position.id, QUESTIONNAIRE_TEMPLATE)
body += '\n\n%s' % render_to_string(path, context)
send_mail_text(None, to_email, from_email, subject, body)
message = ('success', 'An query has been sent to each person, asking them to accept (or decline) the nominations')
else:
message = ('warning', "Please, select some nominee")