Show if nomcom has a public key

Fixes #1033
 - Legacy-Id: 5712
This commit is contained in:
Emilio Jiménez 2013-05-08 12:59:55 +00:00
parent 454128b165
commit f3b3a21ccb
2 changed files with 15 additions and 1 deletions

View file

@ -280,6 +280,16 @@ class EditNomcomForm(BaseNomcomForm, forms.ModelForm):
fieldsets = [('Edit nomcom settings', ('public_key', 'initial_text',
'send_questionnaire', 'reminder_interval'))]
def __init__(self, *args, **kwargs):
super(EditNomcomForm, self).__init__(*args, **kwargs)
if self.instance:
if self.instance.public_key:
help_text = "The nomcom already has a public key. Previous data will remain encrypted with the old key"
else:
help_text = "The nomcom has not a public key yet"
self.fields['public_key'].help_text = help_text
class Meta:
model = NomCom
fields = ('public_key', 'initial_text',

View file

@ -440,8 +440,12 @@ def view_feedback_nominee(request, year, nominee_id):
@member_required(role='chair')
def edit_nomcom(request, year):
nomcom = get_nomcom_by_year(year)
has_publickey = nomcom.public_key and True or False
message = ('warning', 'Previous data will remain encrypted with the old key')
if has_publickey:
message = ('warning', 'Previous data will remain encrypted with the old key')
else:
message = ('warning', 'The nomcom has not a public key yet')
ReminderDateInlineFormSet = inlineformset_factory(parent_model=NomCom,
model=ReminderDates,