Commit 5a1c22ea authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

Updated views.py and event_details.py

parent c4b9253c
{% extends 'base.html'%}
{% block title %} {{event.activity}} {% endblock %}
{% block content %}
{% if assignment %}
<h1>{{assignment.name}}</h1>
<ul>
<p>Date and Time: {{event.target_datetime}}</p><br>
<p>Estimated Hours: {{event.target_datetime}}</p><br>
<p>{{event.course}}</p><br>
<p>Mode: {{location.mode}}</p><br>
<p>Venue: {{location.venue}}</p><br>
</ul>
{% else %}
<p>No Available Books.</p>
{% endif %}
<ul>
<li ><button type="button" onclick="window.location.href='/calendar/{{event.pk}}/edit'">Edit Event</button></li>
</ul>
{% endblock %}
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.views.generic import DetailView, CreateView, UpdateView from django.views.generic import DetailView, CreateView, UpdateView
from .models import Event from .models import Event, Location
from .forms import AddEventForm from .forms import AddEventForm
...@@ -11,12 +11,12 @@ def calendar_view(request): ...@@ -11,12 +11,12 @@ def calendar_view(request):
#calendar Detail View for CBV Implementation #calendar Detail View for CBV Implementation
class EventDetailView(DetailView): class EventDetailView(DetailView):
model = Event model = Event, Location
template_name = 'event-details.html' template_name = 'event-details.html'
context_object_name = 'event' context_object_name = 'event'
class EventAddListView(CreateView): class EventAddListView(CreateView):
model = Event model = Event, Location
form_class = AddEventForm form_class = AddEventForm
template_name = "event-add.html" template_name = "event-add.html"
...@@ -32,7 +32,7 @@ class EventAddListView(CreateView): ...@@ -32,7 +32,7 @@ class EventAddListView(CreateView):
# calendar for editing CBV implementation. # calendar for editing CBV implementation.
class EventEditView(UpdateView): class EventEditView(UpdateView):
model = Event model = Event, Location
form_class = AddEventForm form_class = AddEventForm
template_name = 'event-edit.html' template_name = 'event-edit.html'
......
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