Skip to content
Snippets Groups Projects

Feature/dummy data pdp

Merged Carlos Vega requested to merge feature/dummy_data_pdp into master
1 unresolved thread
Files
18
import logging
from django.forms import ModelForm
from web.models import Study, StudyNotificationParameters, StudyColumns
from django.forms import ModelForm, ValidationError
from web.models import Study, StudyNotificationParameters, StudyColumns, StudySubject
logger = logging.getLogger(__name__)
@@ -12,6 +11,16 @@ class StudyEditForm(ModelForm):
def __init__(self, *args, **kwargs):
super(StudyEditForm, self).__init__(*args, **kwargs)
def clean_nd_number_study_subject_regex(self):
nd_number_study_subject_regex = self.cleaned_data.get(
'nd_number_study_subject_regex')
if StudySubject.check_nd_number_regex(nd_number_study_subject_regex) == False:
raise ValidationError(
'Please enter a valid nd_number_study_subject_regex regex.')
return nd_number_study_subject_regex
class Meta:
model = Study
fields = '__all__'
@@ -21,7 +30,8 @@ class StudyEditForm(ModelForm):
class StudyNotificationParametersEditForm(ModelForm):
def __init__(self, *args, **kwargs):
super(StudyNotificationParametersEditForm, self).__init__(*args, **kwargs)
super(StudyNotificationParametersEditForm,
self).__init__(*args, **kwargs)
class Meta:
model = StudyNotificationParameters
Loading