Skip to content

Commit f3b3a21

Browse files
committed
Show if nomcom has a public key
Fixes ietf-tools#1033 - Legacy-Id: 5712
1 parent 454128b commit f3b3a21

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

ietf/nomcom/forms.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,16 @@ class EditNomcomForm(BaseNomcomForm, forms.ModelForm):
280280
fieldsets = [('Edit nomcom settings', ('public_key', 'initial_text',
281281
'send_questionnaire', 'reminder_interval'))]
282282

283+
def __init__(self, *args, **kwargs):
284+
super(EditNomcomForm, self).__init__(*args, **kwargs)
285+
286+
if self.instance:
287+
if self.instance.public_key:
288+
help_text = "The nomcom already has a public key. Previous data will remain encrypted with the old key"
289+
else:
290+
help_text = "The nomcom has not a public key yet"
291+
self.fields['public_key'].help_text = help_text
292+
283293
class Meta:
284294
model = NomCom
285295
fields = ('public_key', 'initial_text',

ietf/nomcom/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,12 @@ def view_feedback_nominee(request, year, nominee_id):
440440
@member_required(role='chair')
441441
def edit_nomcom(request, year):
442442
nomcom = get_nomcom_by_year(year)
443+
has_publickey = nomcom.public_key and True or False
443444

444-
message = ('warning', 'Previous data will remain encrypted with the old key')
445+
if has_publickey:
446+
message = ('warning', 'Previous data will remain encrypted with the old key')
447+
else:
448+
message = ('warning', 'The nomcom has not a public key yet')
445449

446450
ReminderDateInlineFormSet = inlineformset_factory(parent_model=NomCom,
447451
model=ReminderDates,

0 commit comments

Comments
 (0)