@@ -325,7 +325,7 @@ def save(self):
325325class NominateForm (BaseNomcomForm , forms .ModelForm ):
326326 comments = forms .CharField (label = "Candidate's qualifications for the position" ,
327327 widget = forms .Textarea ())
328- confirmation = forms .BooleanField (label = 'Email comments back to me as confirmation' ,
328+ confirmation = forms .BooleanField (label = 'Email comments back to me as confirmation. ' ,
329329 help_text = "If you want to get a confirmation mail containing your feedback in cleartext, please check the 'email comments back to me as confirmation'." ,
330330 required = False )
331331
@@ -430,18 +430,11 @@ class Meta:
430430
431431
432432class FeedbackForm (BaseNomcomForm , forms .ModelForm ):
433- position_name = forms .CharField (label = 'Position' ,
434- widget = forms .TextInput (attrs = {'size' : '40' }))
435- nominee_name = forms .CharField (label = 'Nominee name' ,
436- widget = forms .TextInput (attrs = {'size' : '40' }))
437- nominee_email = forms .CharField (label = 'Nominee email' ,
438- widget = forms .TextInput (attrs = {'size' : '40' }))
439- nominator_email = forms .CharField (label = 'Commenter email' )
440-
441- comments = forms .CharField (label = 'Comments on this nominee' ,
433+ nominator_email = forms .CharField (label = 'Commenter email' ,required = False )
434+
435+ comments = forms .CharField (label = 'Comments' ,
442436 widget = forms .Textarea ())
443- confirmation = forms .BooleanField (label = 'Email comments back to me as confirmation' ,
444- help_text = "If you want to get a confirmation mail containing your feedback in cleartext, please check the 'email comments back to me as confirmation'." ,
437+ confirmation = forms .BooleanField (label = 'Email comments back to me as confirmation (if selected, your comments will be emailed to you in cleartext when you press Save).' ,
445438 required = False )
446439
447440 def __init__ (self , * args , ** kwargs ):
@@ -453,66 +446,38 @@ def __init__(self, *args, **kwargs):
453446
454447 super (FeedbackForm , self ).__init__ (* args , ** kwargs )
455448
456- readonly_fields = ['position_name' ,
457- 'nominee_name' ,
458- 'nominee_email' ]
459-
460- fieldset = ['position_name' ,
461- 'nominee_name' ,
462- 'nominee_email' ,
463- 'nominator_email' ,
464- 'comments' ]
449+ author = get_user_email (self .user )
465450
466451 if self .public :
467- readonly_fields += ['nominator_email' ]
468- fieldset .append ('confirmation' )
452+ self .fields .pop ('nominator_email' )
469453 else :
470454 help_text = """(Nomcom Chair/Member: please fill this in. Use your own email address if the person making the
471455 comments wishes to be anonymous. The confirmation email will be sent to the address given here,
472456 and the address will also be captured as part of the registered nomination.)"""
473457 self .fields ['nominator_email' ].help_text = help_text
474- self .fields ['nominator_email' ].required = False
475-
476- author = get_user_email (self .user )
477- if author :
478- self .fields ['nominator_email' ].initial = author .address
479-
480- if self .position and self .nominee :
481- self .fields ['position_name' ].initial = self .position .name
482- self .fields ['nominee_name' ].initial = self .nominee .email .person .name
483- self .fields ['nominee_email' ].initial = self .nominee .email .address
484- else :
485- help_text = "Please pick a name on the nominees list"
486- self .fields ['position_name' ].initial = help_text
487- self .fields ['nominee_name' ].initial = help_text
488- self .fields ['nominee_email' ].initial = help_text
489- self .fields ['comments' ].initial = help_text
490- readonly_fields += ['comments' ]
491- self .fields ['confirmation' ].widget .attrs ['disabled' ] = "disabled"
492-
493- for field in readonly_fields :
494- self .fields [field ].widget .attrs ['readonly' ] = True
458+ self .fields ['confirmation' ].label = 'Email these comments in cleartext to the provided commenter email address'
459+ if author :
460+ self .fields ['nominator_email' ].initial = author .address
495461
496- self .fieldsets = [('Provide comments' , fieldset )]
497462
498463 def clean (self ):
499464 if not NomineePosition .objects .accepted ().filter (nominee = self .nominee ,
500465 position = self .position ):
501466 msg = "There isn't a accepted nomination for %s on the %s position" % (self .nominee , self .position )
502- self ._errors ["nominee_email " ] = self .error_class ([msg ])
467+ self ._errors ["comments " ] = self .error_class ([msg ])
503468 return self .cleaned_data
504469
505470 def save (self , commit = True ):
506471 feedback = super (FeedbackForm , self ).save (commit = False )
507472 confirmation = self .cleaned_data ['confirmation' ]
508473 comments = self .cleaned_data ['comments' ]
509- nominator_email = self .cleaned_data ['nominator_email' ]
510474 nomcom_template_path = '/nomcom/%s/' % self .nomcom .group .acronym
511475
512476 author = None
513477 if self .public :
514478 author = get_user_email (self .user )
515479 else :
480+ nominator_email = self .cleaned_data ['nominator_email' ]
516481 if nominator_email :
517482 emails = Email .objects .filter (address = nominator_email )
518483 author = emails and emails [0 ] or None
@@ -541,11 +506,11 @@ def save(self, commit=True):
541506
542507 class Meta :
543508 model = Feedback
544- fields = ('nominee_name' ,
545- 'nominee_email' ,
509+ fields = (
546510 'nominator_email' ,
511+ 'comments' ,
547512 'confirmation' ,
548- 'comments' )
513+ )
549514
550515class FeedbackEmailForm (BaseNomcomForm , forms .Form ):
551516
0 commit comments