Commit 2e38a414 authored by Jose Gabriel L. Salas's avatar Jose Gabriel L. Salas

updated templates to display populated data and the ability to add/edit data...

updated templates to display populated data and the ability to add/edit data in its corresponding html page
parent 728bea19
<!-- calendar --> <!-- calendar -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Calendar v2{% endblock %}
{% block heading %}Widget's Calendar of Activities{% endblock %}
{% block content %}
<p>
{% for event in activities %}
<a href="{{ event.get_absolute_url }}">
{{ event.activity }}
</a><br>
{% endfor %}
</p>
{% endblock %}
{% block footing %}
<a href="{% url 'widget_calendar:event-add' %}">
<button class="btn add">New Activity</button><br>
</a>
<a href="/dashboard/">Dashboard</a><br>
<a href="/announcements/">Announcements</a><br>
<a href="/forum/">Forum</a><br>
<a href="/assignments/">Assignments</a>
{% endblock %}
<!-- event-add --> <!-- event-add -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Add Widget User{% endblock %}
{% block heading %}<h1>Add a new activity:</h1>{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save New Activity">
</form>
{% endblock %}
<!-- event-details --> <!-- event-details -->
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object.activity }}{% endblock %}
{% block heading %}
<h1>
{{ object.activity }}
</h1>
{% endblock %}
{% block content %}
<p>
Date and Time: {{ object.target_datetime|date:"m/d/Y" }}, {{ object.target_datetime|time:"g:iA" }} <br>
Estimated Hours: {{ object.estimated_hours }}<br>
{{ object.course.code}} {{ object.course.title}}-{{ object.course.section}}<br>
Mode: {{ object.location.mode }}<br>
Venue: {{ object.location.venue }}<br>
</p>
{% endblock %}
{% block footing %}
<a href="{% url 'widget_calendar:event-edit' object.pk %}">
<button class="btn edit">Edit Activity</button>
</a>
{% endblock %}
<!-- event-edit --> <!-- event-edit -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Activity{% endblock %}
{% block heading %}Edit Activity:{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save New Activity">
</form>
{% endblock %}
...@@ -2,10 +2,10 @@ from django.urls import path ...@@ -2,10 +2,10 @@ from django.urls import path
from .views import (calendar, EventDetailView, EventCreateView, EventUpdateView) from .views import (calendar, EventDetailView, EventCreateView, EventUpdateView)
urlpatterns = [ urlpatterns = [
path('calendar/', calendar, name='calendar'), path('', calendar, name='calendar'),
path('calendar/events/<int:pk>/details/', EventDetailView.as_view(), name='event-details'), path('events/<int:pk>/details/', EventDetailView.as_view(), name='event-details'),
path('calendar/events/add/', EventCreateView.as_view(), name='event-add'), path('events/add/', EventCreateView.as_view(), name='event-add'),
path('calendar/events/<int:pk>/edit/', EventUpdateView.as_view(), name='event-edit'), path('events/<int:pk>/edit/', EventUpdateView.as_view(), name='event-edit'),
] ]
# This might be needed, depending on your Django version # This might be needed, depending on your Django version
......
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