From 6964155a0063f755917039a8f2c0a298416ff783 Mon Sep 17 00:00:00 2001 From: "David I. Allan" Date: Sat, 15 Jul 2017 14:32:09 +0000 Subject: [PATCH] 2183 fix to status update forms commit ready for merge - Legacy-Id: 13905 --- ietf/group/forms.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ietf/group/forms.py b/ietf/group/forms.py index 83e9a680b..023d2e0ab 100644 --- a/ietf/group/forms.py +++ b/ietf/group/forms.py @@ -34,7 +34,7 @@ def roles_for_group_type(group_type): # --- Forms ------------------------------------------------------------ class StatusUpdateForm(forms.Form): - content = forms.CharField(widget=forms.Textarea, label='Status update', help_text = 'Edit the status update', required=False, strip=False) + content = forms.CharField(widget=forms.Textarea, label='Status update', help_text = "Enter the status update", required=False, strip=False) txt = forms.FileField(label='.txt format', help_text='Or upload a .txt file', required=False) def clean_content(self): @@ -43,6 +43,13 @@ class StatusUpdateForm(forms.Form): def clean_txt(self): return get_cleaned_text_file_content(self.cleaned_data["txt"]) + def clean(self): + if (self.cleaned_data['content'] and self.cleaned_data['content'].strip() and self.cleaned_data['txt']): + raise forms.ValidationError("Cannot enter both text box and TXT file") + elif (self.cleaned_data['content'] and not self.cleaned_data['content'].strip() and not self.cleaned_data['txt']): + raise forms.ValidationError("NULL input is not a valid option") + elif (self.cleaned_data['txt'] and not self.cleaned_data['txt'].strip()) : + raise forms.ValidationError("NULL TXT file input is not a valid option") class ConcludeGroupForm(forms.Form): instructions = forms.CharField(widget=forms.Textarea(attrs={'rows': 30}), required=True, strip=False)