Commit a80f3f9c authored by Javi Ng's avatar Javi Ng

fixed timezone issue for calendar, updated README sources

parent ac174693
......@@ -21,7 +21,7 @@ Submission Date: MM/DD/YYYY
We truthfully completed this project (this project being Midterm Project: Widget v1). There are no lies because it is true.
References:
Wala pa naman
Date-time conversion to timezone in views: https://stackoverflow.com/questions/35072711/django-datetime-field-convert-to-timezone-in-view
(sgd) Angelo Joaquin B. Alvarez, 02/27/2023
(Sgd) Gabriel S. Limbaga, 02/28/2023
......
from django.shortcuts import render
from django.http import HttpResponse
from .models import Event
from django.utils import timezone
# Create your views here.
def index(request):
......@@ -8,6 +9,7 @@ def index(request):
events = Event.objects.all()
for event in events:
localdatetime = timezone.localtime(event.target_datetime)
eventInfo += '''
Date and Time: {} <br>
Activity: {} <br>
......@@ -17,7 +19,7 @@ def index(request):
Venue: {} <br>
<br>
'''.format(
event.target_datetime.strftime("%m/%d/%Y, %I:%M %p"),
localdatetime.strftime("%m/%d/%Y, %I:%M %p"),
event.activity(),
event.estimated_hours(),
event.course.code(), event.course.title(), event.course.section(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment