diff --git a/smash/web/forms/study_subject_forms.py b/smash/web/forms/study_subject_forms.py index 1a2f843a9b8f2804d8f9e97809b194fadf04ec36..6211544bd6817c549a35561bb9ce1e60786a3b86 100644 --- a/smash/web/forms/study_subject_forms.py +++ b/smash/web/forms/study_subject_forms.py @@ -36,31 +36,31 @@ def create_field_for_custom_study_subject_field(study_subject_field: CustomStudy val = field_value.value if study_subject_field.type == CUSTOM_FIELD_TYPE_TEXT: field = forms.CharField(label=study_subject_field.name, initial=val, - required=study_subject_field.obligatory, disabled=study_subject_field.readonly) + required=study_subject_field.required, disabled=study_subject_field.readonly) elif study_subject_field.type == CUSTOM_FIELD_TYPE_BOOLEAN: initial = False if val is not None and val.lower() == 'true': initial = True field = forms.BooleanField(label=study_subject_field.name, initial=initial, - required=study_subject_field.obligatory, disabled=study_subject_field.readonly) + required=study_subject_field.required, disabled=study_subject_field.readonly) elif study_subject_field.type == CUSTOM_FIELD_TYPE_INTEGER: initial = None if val is not None and re.match(r"[-+]?\d+$", val) is not None: initial = int(val) field = forms.IntegerField(label=study_subject_field.name, initial=initial, - required=study_subject_field.obligatory, disabled=study_subject_field.readonly) + required=study_subject_field.required, disabled=study_subject_field.readonly) elif study_subject_field.type == CUSTOM_FIELD_TYPE_DOUBLE: initial = None if val is not None and re.match(r"[-+]?\d+?\.\d+?$", val) is not None: initial = float(val) field = forms.FloatField(label=study_subject_field.name, initial=initial, - required=study_subject_field.obligatory, disabled=study_subject_field.readonly) + required=study_subject_field.required, disabled=study_subject_field.readonly) elif study_subject_field.type == CUSTOM_FIELD_TYPE_DATE: initial = None if val is not None and val != '': initial = datetime.datetime.strptime(val, '%Y-%m-%d') field = forms.DateTimeField(label=study_subject_field.name, initial=initial, - required=study_subject_field.obligatory, disabled=study_subject_field.readonly, + required=study_subject_field.required, disabled=study_subject_field.readonly, widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d")) elif study_subject_field.type == CUSTOM_FIELD_TYPE_SELECT_LIST: initial = '0' @@ -68,7 +68,7 @@ def create_field_for_custom_study_subject_field(study_subject_field: CustomStudy if k == val: initial = v field = forms.ChoiceField(label=study_subject_field.name, initial=initial, - required=study_subject_field.obligatory, disabled=study_subject_field.readonly, + required=study_subject_field.required, disabled=study_subject_field.readonly, choices=get_custom_select_choices(study_subject_field.possible_values)) elif study_subject_field.type == CUSTOM_FIELD_TYPE_FILE: initial = None @@ -86,7 +86,7 @@ def create_field_for_custom_study_subject_field(study_subject_field: CustomStudy field = forms.FileField( label=study_subject_field.name, - required=study_subject_field.obligatory, + required=study_subject_field.required, disabled=study_subject_field.readonly, initial=initial, widget=SecuredFileWidget(attrs={'multiple': True}) diff --git a/smash/web/migrations/0176_customstudysubjectfield_customstudysubjectvalue.py b/smash/web/migrations/0176_customstudysubjectfield_customstudysubjectvalue.py index 45bafa3ddac939880a90dcd562f1b4e9cf456255..3bd85b5f8e3ed980bbd12892fee43c8d86a76911 100644 --- a/smash/web/migrations/0176_customstudysubjectfield_customstudysubjectvalue.py +++ b/smash/web/migrations/0176_customstudysubjectfield_customstudysubjectvalue.py @@ -20,7 +20,7 @@ class Migration(migrations.Migration): ('possible_values', models.CharField(blank=True, default='', max_length=1024, null=True)), ('default_value', models.CharField(blank=True, max_length=20, null=True)), ('readonly', models.BooleanField(default=False)), - ('obligatory', models.BooleanField(default=False)), + ('required', models.BooleanField(default=False)), ('unique', models.BooleanField(default=False)), ('study', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='web.Study', verbose_name='Study')), ], diff --git a/smash/web/models/custom_data/custom_study_subject_field.py b/smash/web/models/custom_data/custom_study_subject_field.py index 8c5bb0be00caddab13490a92ccd50f19e928a614..5e096da35e40804ca12975a303bfe153cc7e15e2 100644 --- a/smash/web/models/custom_data/custom_study_subject_field.py +++ b/smash/web/models/custom_data/custom_study_subject_field.py @@ -14,7 +14,7 @@ class CustomStudySubjectField(models.Model): default_value = models.CharField(max_length=20, null=True, blank=True) readonly = models.BooleanField(default=False) - obligatory = models.BooleanField(default=False) + required = models.BooleanField(default=False) unique = models.BooleanField(default=False)