Commit 22e4b5fe authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

Updated view.py for calendar app

parent 356cfd01
from django.http import HttpResponse from django.http import HttpResponse
from .models import Event, Location
def calendarIndex(request): def calendarIndex(request):
return HttpResponse('Widget’s Calendar of Activities') title = 'Widget’s Calendar of Activities<br><br>'
\ No newline at end of file events = Event.objects.all()
output_view = ""
for event in events:
date_and_time = "Date and Time: " + event.target_datetime.strftime("%m/%d/%Y, %I:%M %p") + "<br>"
event_activity = "Activity: " + event.activity + "<br>"
estimated_duration = "Estimated Hours: " + event.estimated_hours + "<br>"
course_section = "Course/Section: " + event.course.code + " " + event.course.title + "-" + event.course.section + "<br>"
event_mode = "Mode: " + event.location.mode + "<br>"
event_venue = "Venue: " + event.location.venue + "<br>"
output_view = output_view + date_and_time + event_activity + estimated_duration + course_section + event_mode + event_venue
return HttpResponse(title + output_view)
\ No newline at end of file
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