diff --git a/smash/web/forms/study_subject_forms.py b/smash/web/forms/study_subject_forms.py index f27a259cecae82bcbfbe77ce6f4a559b6cf04295..bc97e8b069bc1abefce9d7628d9384392f8c5995 100644 --- a/smash/web/forms/study_subject_forms.py +++ b/smash/web/forms/study_subject_forms.py @@ -14,19 +14,9 @@ logger = logging.getLogger(__name__) class StudySubjectForm(ModelForm): - datetime_contact_reminder = forms.DateTimeField(label="Contact on", - widget=forms.DateTimeInput( - DATETIMEPICKER_DATE_ATTRS), - required=False - ) - - referral_letter = forms.FileField( - label='Referral letter', widget=SecuredFileWidget(), required=False) - - voucher_types = forms.ModelMultipleChoiceField(required=False, - widget=forms.CheckboxSelectMultiple, - queryset=VoucherType.objects.all(), - ) + datetime_contact_reminder = forms.DateTimeField(label="Contact on", widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS), required=False) + referral_letter = forms.FileField(label='Referral letter', widget=SecuredFileWidget(), required=False) + voucher_types = forms.ModelMultipleChoiceField(required=False, widget=forms.CheckboxSelectMultiple, queryset=VoucherType.objects.all()) def __init__(self, *args, **kwargs): super(StudySubjectForm, self).__init__(*args, **kwargs) @@ -57,8 +47,7 @@ class StudySubjectAddForm(StudySubjectForm): if not screening_number: prefix_screening_number = self.get_prefix_screening_number() if prefix_screening_number is not None: - screening_number = get_new_screening_number( - prefix_screening_number) + screening_number = get_new_screening_number(prefix_screening_number) return screening_number def clean(self): @@ -79,8 +68,7 @@ class StudySubjectAddForm(StudySubjectForm): else: subject_type = self.cleaned_data.get('type', None) if subject_type is not None: - screening_number_prefix = SCREENING_NUMBER_PREFIXES_FOR_TYPE[ - subject_type] + screening_number_prefix = SCREENING_NUMBER_PREFIXES_FOR_TYPE[subject_type] if screening_number_prefix is None: return None prefix_screening_number = screening_number_prefix + "-" @@ -89,8 +77,7 @@ class StudySubjectAddForm(StudySubjectForm): def get_new_screening_number(screening_number_prefix): result_number = 0 - subjects = StudySubject.objects.filter( - screening_number__contains=screening_number_prefix) + subjects = StudySubject.objects.filter(screening_number__contains=screening_number_prefix) for subject in subjects: screening_numbers = subject.screening_number.split(";") for screening_number in screening_numbers: @@ -199,8 +186,7 @@ def validate_subject_screening_number(self, cleaned_data): subjects_from_db = StudySubject.objects.filter(screening_number=cleaned_data["screening_number"], study=self.study) if len(subjects_from_db) > 0: - self.add_error('screening_number', - "Screening number already in use") + self.add_error('screening_number', "Screening number already in use") def validate_subject_nd_number(self, cleaned_data):