diff --git a/tjdests/apps/profile/forms.py b/tjdests/apps/profile/forms.py index e913a99..12eb9c3 100644 --- a/tjdests/apps/profile/forms.py +++ b/tjdests/apps/profile/forms.py @@ -72,6 +72,11 @@ class DecisionForm(forms.ModelForm): ): raise ValidationError("You cannot add a second entry for this college") + # Rolling and RD decisions cannot be deferred + if cleaned_data.get("decision_type") in [Decision.REGULAR_DECISION, Decision.ROLLING]: + if "DEFER" in cleaned_data.get("admission_status"): + raise ValidationError("Regular Decision and Rolling decisions cannot result in a deferral") + return cleaned_data diff --git a/tjdests/apps/profile/tests.py b/tjdests/apps/profile/tests.py index 0a13b09..fde12df 100644 --- a/tjdests/apps/profile/tests.py +++ b/tjdests/apps/profile/tests.py @@ -426,6 +426,30 @@ class ProfileTest(TJDestsTestCase): self.assertEqual(200, response.status_code) self.assertEqual(1, Decision.objects.filter(college=college, user=user).count()) + # No deferrals for RD and rolling + Decision.objects.all().delete() + response = self.client.post( + reverse("profile:decision_add"), + data={ + "college": college.id, + "decision_type": "RD", + "admission_status": "DEFER_WAITLIST_ADMIT", + }, + ) + self.assertEqual(200, response.status_code) + self.assertEqual(0, Decision.objects.filter(college=college, user=user).count()) + + response = self.client.post( + reverse("profile:decision_add"), + data={ + "college": college.id, + "decision_type": "RD", + "admission_status": "WAITLIST", + }, + ) + self.assertEqual(302, response.status_code) + self.assertEqual(1, Decision.objects.filter(college=college, user=user, admission_status=Decision.WAITLIST).count()) + def test_decision_update(self): user = self.login(make_senior=True, make_student=True, accept_tos=True)