Commit 9b582d5e authored by Ysabella Panghulan's avatar Ysabella Panghulan

added import Course in models and edited views.py of calendar app

parent f44d01ed
from django.db import models from django.db import models
from assignments.models import Course
# Create your models here. # Create your models here.
class Location(models.Model): class Location(models.Model):
......
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse
from .models import Location, Event
# Create your views here. # Create your views here.
def index(request):
events = Event.objects.all()
welcomeMessage = 'Widget’s Calendar of Activities <br><br>'
activities = ''
for event in events:
activities += 'Date and Time: ' + event.target_datetime.strftime('%m/%d/%Y, %I:%M%p') + '<br>'
activities += 'Activity: '+ event.activity + '</br>'
activities += 'Estimated Hours: ' + str(event.estimated_hours) + '<br>'
activities += 'Course/Section: ' + event.course.title + '<br>'
activities += 'Mode: ' + event.location.mode + '<br>'
activities += 'Venue: ' + event.location.venue + '<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