Skip to content

Commit

Permalink
changed nightpass export format
Browse files Browse the repository at this point in the history
  • Loading branch information
Pancham1603 committed Dec 3, 2023
1 parent f381fff commit debc319
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def hostel_check_in(self, obj):
hostel_check_in.short_description = 'Hostel In'

def export_as_xlsx(modeladmin, request, queryset):
headers = ['User', 'Email', 'Hostel', 'Pass ID', 'Date', 'Campus Resource', 'Check In','Check In Time', 'Check Out', 'Check Out Time', 'Hostel Check Out Time' ,'Hostel Check In Time', 'Defaulter', 'Remarks']
headers = ['User', 'Email', 'Hostel', 'Pass ID', 'Date', 'Campus Resource', 'Check In', 'Check Out', 'Hostel Check Out Time', 'Check In Time', 'Check Out Time' ,'Hostel Check In Time', 'Defaulter', 'Remarks']
data = []
for obj in queryset:
data.append([obj.user.student.name,
Expand All @@ -39,10 +39,10 @@ def export_as_xlsx(modeladmin, request, queryset):
obj.date.strftime('%d/%m/%y'),
obj.campus_resource.name,
obj.check_in,
timezone.localtime(obj.check_in_time).strftime('%H:%M:%S') if obj.check_in_time is not None else None,
obj.check_out,
timezone.localtime(obj.check_out_time).strftime('%H:%M:%S') if obj.check_out_time is not None else None,
timezone.localtime(obj.hostel_checkout_time).strftime('%H:%M:%S') if obj.hostel_checkout_time is not None else None,
timezone.localtime(obj.check_in_time).strftime('%H:%M:%S') if obj.check_in_time is not None else None,
timezone.localtime(obj.check_out_time).strftime('%H:%M:%S') if obj.check_out_time is not None else None,
timezone.localtime(obj.hostel_checkin_time).strftime('%H:%M:%S') if obj.hostel_checkin_time is not None else None,
obj.defaulter,
obj.defaulter_remarks])
Expand Down

0 comments on commit debc319

Please sign in to comment.