6
6
Since: 2.0.0
7
7
"""
8
8
9
- import pytz
10
9
from django .http import JsonResponse
11
10
from django .shortcuts import render
12
11
from django .urls import reverse
13
- from django .conf import settings
14
12
15
13
from appointment .settings import APPOINTMENT_ADMIN_BASE_TEMPLATE , APPOINTMENT_BASE_TEMPLATE
16
14
from appointment .utils .db_helpers import username_in_user_model
20
18
def convert_appointment_to_json (request , appointments : list ) -> list :
21
19
"""Convert a queryset of Appointment objects to a JSON serializable format."""
22
20
su = request .user .is_superuser
23
- tz = pytz .timezone (settings .TIME_ZONE )
24
21
return [{
25
22
"id" : appt .id ,
26
23
"client" : appt .client .username if username_in_user_model () else "" ,
27
- "start_time" : tz . localize ( appt .get_start_time () ).isoformat (),
28
- "end_time" : tz . localize ( appt .get_end_time () ).isoformat (),
24
+ "start_time" : appt .get_start_time ().isoformat (),
25
+ "end_time" : appt .get_end_time ().isoformat (),
29
26
"client_name" : appt .get_client_name (),
30
27
"url" : appt .get_absolute_url (request ),
31
28
"background_color" : appt .get_background_color (),
@@ -37,7 +34,6 @@ def convert_appointment_to_json(request, appointments: list) -> list:
37
34
"staff_id" : appt .appointment_request .staff_member .id ,
38
35
"additional_info" : appt .additional_info ,
39
36
"want_reminder" : appt .want_reminder ,
40
- "timezone" : settings .TIME_ZONE ,
41
37
} for appt in appointments ]
42
38
43
39
@@ -59,7 +55,6 @@ def get_generic_context(request, admin=True):
59
55
return {
60
56
'BASE_TEMPLATE' : APPOINTMENT_ADMIN_BASE_TEMPLATE if admin else APPOINTMENT_BASE_TEMPLATE ,
61
57
'user' : request .user ,
62
- 'timezone' : settings .TIME_ZONE ,
63
58
'is_superuser' : request .user .is_superuser ,
64
59
}
65
60
0 commit comments