Commit 0f8ec36f authored by Angelo Alvarez's avatar Angelo Alvarez

Added Event Details pages

parent fc14d6bf
......@@ -14,7 +14,9 @@ class Location(models.Model):
venue = models.TextField(max_length=255)
def __str__(self):
return self.venue
return self.venue.replace('\r\n', ' or ')
class Event(models.Model):
......
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object.title }}{% endblock %}
{% block content %}
<h1>{{ object.activity }}</h1>
<b>Date and Time: </b> {{ object.target_datetime|date:"m/d/Y, h:i A" }} <br>
<b>Estimated Hours: </b>{{ object.estimated_hours }} <br>
<b>Course: </b>{{ object.course.code }} {{ object.course.title }} - {{ object.course.section }} <br>
<b>Mode: </b>{{ object.location.mode }} <br>
<b>Venue: </b>{{ object.location|urlize }} <br>
<form action="../events/edit">
<button type="Submit">Edit Activity</button>
</form>
{% endblock %}
......@@ -13,36 +13,6 @@ def calendar(request):
return render(request, 'calendar_app/calendar.html', context)
class EventDetailView(DetailView):
template_name = 'calendar_app/event-detail.html'
template_name = 'calendar_app/event-details.html'
model = Event
"""
def index(request):
eventInfo = ""
events = Event.objects.all()
for event in events:
localdatetime = timezone.localtime(event.target_datetime)
eventInfo += '''
Date and Time: {} <br>
Activity: {} <br>
Estimated Hours: {} <br>
Course/Section: {} {}-{} <br>
Mode: {} <br>
Venue: {} <br>
<br>
'''.format(
localdatetime.strftime("%m/%d/%Y, %I:%M %p"),
event.activity,
event.estimated_hours,
event.course.code, event.course.title, event.course.section,
event.location.mode,
event.location.venue
)
return HttpResponse('''
Widget's Calendar of Activities <br>
<br>
{}
'''.format(eventInfo))
"""
\ 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