Commit fc14d6bf authored by Angelo Alvarez's avatar Angelo Alvarez

Updated Calendar Homepage

parent 7a68e88b
from django.db import models
from assignments.models import Course
from django.urls import reverse
# Create your models here.
class Location(models.Model):
......@@ -27,3 +28,6 @@ class Event(models.Model):
def __str__(self):
return self.activity
def get_absolute_url(self):
return reverse('calendar_app:events-details', kwargs={'pk': self.pk})
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget's Calendar of Activities{% endblock %}
{% block content %}
<h1>Widget's Calendar of Activities</h1>
<ul>
{% for object in object_list %}
<li style="list-style-type: circle;"><a href="{{ object.get_absolute_url }}">{{ object.activity }}</a></li>
{% endfor %}
</ul>
<form action="./events/add">
<button type="Submit">New Activity</button>
</form>
<a href="../dashboard/">Dashboard</a> <br>
<a href="../announcements/">Announcements</a> <br>
<a href="../forum/">Forum</a> <br>
<a href="../assignments/">Assignments</a> <br>
{% endblock %}
\ No newline at end of file
# <appname>/urls.py
from django.urls import path
from .views import index
from .views import calendar, EventDetailView
urlpatterns = [
path('', index, name='index'),
path('', calendar, name='calendar'),
path('events/<int:pk>/details/', EventDetailView.as_view(), name='events-details'),
]
app_name = "calendar_app"
\ No newline at end of file
......@@ -2,8 +2,21 @@ from django.shortcuts import render
from django.http import HttpResponse
from .models import Event
from django.utils import timezone
from django.views.generic.detail import DetailView
# Create your views here.
def calendar(request):
context = {}
context["object_list"] = Event.objects.all()
return render(request, 'calendar_app/calendar.html', context)
class EventDetailView(DetailView):
template_name = 'calendar_app/event-detail.html'
model = Event
"""
def index(request):
eventInfo = ""
events = Event.objects.all()
......@@ -31,4 +44,5 @@ def index(request):
Widget's Calendar of Activities <br>
<br>
{}
'''.format(eventInfo))
\ No newline at end of file
'''.format(eventInfo))
"""
\ No newline at end of file
* {
font-family: Arial, sans-serif;
font-size: 16px;
}
\ 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