Skip to content

Commit

Permalink
Update forms.py
Browse files Browse the repository at this point in the history
  • Loading branch information
michplunkett committed Jul 11, 2023
1 parent 858c01f commit 6468e2d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions OpenOversight/app/main/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,13 @@ class DateFieldForm(Form):
date_field = DateField("Date*", validators=[DataRequired()])
time_field = TimeField("Time", validators=[Optional()])

def validate_time_field(self, field):
@staticmethod
def validate_time_field(field):
if not type(field.data) == datetime.time:
raise ValidationError("Not a valid time.")

def validate_date_field(self, field):
@staticmethod
def validate_date_field(field):
if field.data.year < 1900:
raise ValidationError("Incidents prior to 1900 not allowed.")

Expand Down

0 comments on commit 6468e2d

Please sign in to comment.