diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index a2e6584..c269a50 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -188,7 +188,7 @@ def submitApplication(request, id, email, user_type): opening = get_object_or_404(Placement, id=data[OPENING_ID], allowed_batch__contains=[student.batch], allowed_branch__contains=[student.branch], - deadline_datetime__gte=datetime.datetime.now().date() + deadline_datetime__gte=timezone.now() ) if not opening.offer_accepted or not opening.email_verified: raise PermissionError("Placement Not Approved") @@ -209,7 +209,7 @@ def submitApplication(request, id, email, user_type): opening = get_object_or_404(Internship, id=data[OPENING_ID], allowed_batch__contains=[student.batch], allowed_branch__contains=[student.branch], - deadline_datetime__gte=datetime.datetime.now().date() + deadline_datetime__gte=timezone.now() ) if not opening.offer_accepted or not opening.email_verified: raise PermissionError("Internship Not Approved") diff --git a/CDC_Backend/APIs/tests/test_studentView.py b/CDC_Backend/APIs/tests/test_studentView.py index 89ffd93..3674f7c 100644 --- a/CDC_Backend/APIs/tests/test_studentView.py +++ b/CDC_Backend/APIs/tests/test_studentView.py @@ -303,7 +303,7 @@ class StudentViewsTestCase(APITestCase): def test_add_application_placement_deadlinePassed(self): self.placement.deadline_datetime = timezone.now().replace( - hour=0, minute=0, second=0, microsecond=0) - datetime.timedelta(minutes=5) + hour=0, minute=0, second=0, microsecond=0) self.placement.save() # deleted existing application self.placement_application.delete() @@ -561,9 +561,7 @@ class StudentViewsTestCase(APITestCase): student=self.student).count(), 1) def test_add_application_internship_deadlinePassed(self): - # now minus 5 minutes - self.internship.deadline_datetime = timezone.now().replace(hour=0, minute=0, second=0, microsecond=0) - datetime.timedelta(minutes=5) - + self.internship.deadline_datetime = timezone.now().replace(hour=0, minute=0, second=0, microsecond=0) self.internship.save() # deleted existing application self.internship_application.delete()