diff --git a/input/forms.py b/input/forms.py index 4059d72..6d55a3a 100755 --- a/input/forms.py +++ b/input/forms.py @@ -292,18 +292,15 @@ class LiteratureForm(TermsForm): if self.errors: return cleaned_data - return self.clean_selfbuy_fields(cleaned_data) - - def clean_selfbuy_fields(self, cleaned_data): if cleaned_data['selfbuy'] == 'TRUE': cleaned_data['selfbuy_data'] = '' cleaned_data['selfbuy_give_data'] = False - else: - if not cleaned_data.get('selfbuy_data'): - self.add_error('selfbuy_data', trans('This field is required.')) - if not cleaned_data.get('selfbuy_give_data'): - self.add_error('selfbuy_give_data', trans('This field is required.')) + return cleaned_data + + for field in 'selfbuy_data', 'selfbuy_give_data': + if not cleaned_data.get('selfbuy_data'): + self.add_error(field, trans('This field is required.')) return cleaned_data