Skip to content

Commit

Permalink
correcting period 4 bills
Browse files Browse the repository at this point in the history
  • Loading branch information
mittal-ishaan committed Oct 23, 2023
1 parent 32040de commit 0f362f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
14 changes: 13 additions & 1 deletion home/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,8 +859,20 @@ def hostel(self, obj):
def room_number(self, obj):
return obj.email.room_no

actions = ["export_as_csv"]
actions = ["export_as_csv", "update_bill"]

@admin.action(description="Update the bills")
def update_bill(self, request, queryset):
"""
Update action available in the admin page
"""
for obj in queryset:
days = obj.period4_short + obj.period4_long
if(obj.period4_high_tea):
continue
days = 31 - days
obj.period4_bill = days * 115
obj.save()
def export_as_csv(self, request, queryset):
"""
Export action available in the admin page
Expand Down
1 change: 1 addition & 0 deletions home/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class HomeConfig(AppConfig):
def ready(self):
import home.signals
import socket, sys
# bind to port 47200, then check for it for every worker
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(("127.0.0.1", 47200))
Expand Down
2 changes: 1 addition & 1 deletion messWebsite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +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 0f362f2

Please sign in to comment.