Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed views.py on negative days calculation #55

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading