refactor for less duplication

refactored to use a common 'list.html'
refactored to allow some modularization (using blocks)
This commit is contained in:
2021-11-07 15:11:09 -06:00
parent 34000314e7
commit b7012b77df
8 changed files with 23 additions and 111 deletions

View File

@@ -1,15 +1,19 @@
{% load bootstrap5 %}
{% bootstrap_css %}
{% bootstrap_javascript %}
<Title>Schedule</Title>
<h1>Schedule</h1>
<ol>
{% extends 'base.html' %}
{% block title %} {{ title }} {% endblock %}
{% block content %}
<h1>{{ title }}</h1>
<ol class="list-group">
{% for event in events %}
<li>
<li class="list-group-item">
{{ event.away_team.name }} vs. {{ event.home_team.name }} <br>
{{ event.start|date:"l, F j, Y g:i A" }} <br>
{{ event.venue.name }}
</li>
{% endfor %}
</ol>
</ol>
{% endblock %}

View File

@@ -6,4 +6,4 @@ def root(request):
def schedule(request):
events = Event.objects.all()
return render(request, 'events/schedule.html', {'events': events})
return render(request, 'events/schedule.html', {'title':'Schedule', 'events': events})