Skip to content

Commit 253772b

Browse files
🐛 fix TestForms date validation (#13624)
1 parent 4d869b4 commit 253772b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

dojo/forms.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,18 @@ def __init__(self, *args, **kwargs):
11311131
else:
11321132
self.fields["lead"].queryset = get_authorized_users(Permissions.Test_View).filter(is_active=True)
11331133

1134+
def is_valid(self):
1135+
valid = super().is_valid()
1136+
1137+
# we're done now if not valid
1138+
if not valid:
1139+
return valid
1140+
if self.cleaned_data["target_start"] > self.cleaned_data["target_end"]:
1141+
self.add_error("target_start", "Your target start date exceeds your target end date")
1142+
self.add_error("target_end", "Your target start date exceeds your target end date")
1143+
return False
1144+
return True
1145+
11341146
class Meta:
11351147
model = Test
11361148
fields = ["title", "test_type", "target_start", "target_end", "description",

0 commit comments

Comments
 (0)