Commit e26c6ff8 authored by Ysabella Panghulan's avatar Ysabella Panghulan

edited views.py

parent 3d07daed
from django.shortcuts import render from django.shortcuts import render, redirect
from django.http import HttpResponse from django.http import HttpResponse
from .models import Location, Event from .models import Location, Event
# Create your views here. # Create your views here.
def index(request): def Calendar(request):
events = Event.objects.all() locations = Location.objects.all()
welcomeMessage = 'Widget\'s Calendar of Activities <br><br>' events = Event.objects.all()
activities = '' context = {
'locations': locations,
for event in events: 'events': events,
activities += 'Date and Time: ' + event.target_datetime.strftime('%m/%d/%Y, %I:%M %p') + '<br>' }
activities += 'Activity: '+ event.activity + '<br>' return render(request, 'widget_calendar/calendar.html', context)
activities += 'Estimated Hours: ' + str(event.estimated_hours) + '<br>' \ No newline at end of file
activities += 'Course/Section: ' + event.course.code + ' ' + event.course.title + '-' + event.course.section + '<br>'
activities += 'Mode: ' + event.location.mode + '<br>'
activities += 'Venue: ' + event.location.venue + '<br><br>'
return HttpResponse(welcomeMessage + activities)
\ 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