Skip to content

Commit

Permalink
Merge pull request #55 from DaemonLab/srivathsan
Browse files Browse the repository at this point in the history
Changed views.py on negative days calculation
  • Loading branch information
mittal-ishaan authored May 10, 2024
2 parents 1341132 + 6758a67 commit d7e47a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions home/models/students.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ class LongRebate(models.Model):

REASON_TYPE_CHOICES = (
('', 'Choose the reason'),
('Incomplete form', 'Incomplete form'),
('There is a date mismatch between the one written in the form and the one in the attached form', 'There is a date mismatch between the one written in the form and the one in the attached form'),
('Incomplete form. Please submit a new rebate application', 'Incomplete form'),
('Signature of approving authority missing. Please submit a new rebate application', 'Signature missing'),
('Attached file is not the rebate form. Please submit a new rebate application with correct attachment', 'Wrong attached document'),
('There is a date mismatch between the one written in the form and the one in the attached form. Please submit a new rebate application', 'There is a date mismatch between the one written in the form and the one in the attached form'),

)

Expand Down
5 changes: 3 additions & 2 deletions home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,12 @@ def addLongRebateBill(request):
before_rebate_days = (start_date - date.today()).days
days = (end_date - start_date).days + 1
student = Student.objects.get(email__iexact=request.user.email)

if not is_not_duplicate(student, start_date, end_date):
text = "You have already applied for rebate for these dates"
elif before_rebate_days < 2:
text = "Your start date has to be 2 days from todays date"
text = "Your start date has to be 2 days from todays date"
elif days < 0:
text = "Your end date should be after your start date"
else:
# CHANGE THIS TO "FILE NOT UPLOADED".
try:
Expand Down
1 change: 1 addition & 0 deletions messWebsite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"messWebsite.middleware.LoginRequiredMiddleware",
'whitenoise.middleware.WhiteNoiseMiddleware',
'allauth.account.middleware.AccountMiddleware',
]

ROOT_URLCONF = "messWebsite.urls"
Expand Down

0 comments on commit d7e47a3

Please sign in to comment.