Added views.py implementation, template html file, and output for /widget_calendar page

parent af65d1b1
from django.contrib import admin from django.contrib import admin
from .models import Location, Event from .models import Event, Location
class EventAdmin(admin.ModelAdmin): class EventAdmin(admin.ModelAdmin):
model = Event model = Event
......
<p>Widget's Calendar of Activities<br></p>
<ul>
{% for event in events %}
<p>
Date and Time: {{ event.target_datetime }}<br>
Activity: {{ event.activity }}<br>
Estimated Hours: {{ event.estimated_hours }}<br>
Course/Section: {{ event.course }}<br>
Mode: {{ event.location.mode }}<br>
Venue: {{ event.location.venue }}<br>
</p>
{% endfor %}
</ul>
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from .models import Event, Location
def pageview(request): def pageview(request):
return HttpResponse() events = Event.objects.all()
locations = Location.objects.all()
return render(request, 'widget_calendar/widget_calendar.html', {'events': events, 'locations': locations})
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