Commit 75b62bae authored by Gabriel Geraldo's avatar Gabriel Geraldo

edited the views for app widget_calendar

parent eff51892
from django.shortcuts import render
from django.http import HttpResponse
from .models import Event, Location
def index(HttpRequest):
return HttpResponse('''
html_output = '''
<html>
<head>
<title>Calendar</title>
</head>
<body>
<h1>Widget's Calendar of Activities</h1>
<p>to be created</p>
'''
for event in Event.objects.all():
html_output += '''
<p>
Date and Time: {}<br>
Activity: {}<br>
Estimated Hours: {}<br>
Course/Section: {} {}-{}<br>
Mode: {}<br>
Venue: {}<br>
</p>
'''.format(
event.target_datetime.strftime("%m/%d/%Y, %I:%M %p"),
event.activity,
event.estimated_hours,
event.course,
event.course.title,
event.course.section,
event.location.mode,
event.location.venue
)
html_output += '''
</body>
</html>
''')
\ No newline at end of file
'''
return HttpResponse(html_output)
\ 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