Skip to content

Commit

Permalink
Add model validators to screening report_datetime
Browse files Browse the repository at this point in the history
... (datetime_not_before_study_start, datetime_not_future)
  • Loading branch information
JonathanWillitts committed May 20, 2024
1 parent 43c6aa2 commit 01ba6c2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions edc_screening/model_mixins/screening_fields_model_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from django_crypto_fields.fields import EncryptedCharField
from edc_constants.choices import GENDER, YES_NO, YES_NO_NA
from edc_constants.constants import NO, NOT_APPLICABLE
from edc_model.validators import datetime_not_future
from edc_protocol.validators import datetime_not_before_study_start
from edc_sites.model_mixins import SiteModelMixin
from edc_utils.date import get_utcnow

Expand All @@ -30,6 +32,7 @@ class ScreeningFieldsModeMixin(SiteModelMixin, models.Model):

report_datetime = models.DateTimeField(
verbose_name="Report Date and Time",
validators=[datetime_not_before_study_start, datetime_not_future],
default=get_utcnow,
help_text="Date and time of report.",
)
Expand Down

0 comments on commit 01ba6c2

Please sign in to comment.