Add MonthlyTrip model and MonthlyTripView
This commit is contained in:
parent
0a4f3da34c
commit
646845e44d
7 changed files with 169 additions and 42 deletions
|
@ -37,6 +37,7 @@
|
|||
<li><strong>Average Litre Price:</strong> {{ summary.avg_price|floatformat:3|default:"0.000" }} €</li>
|
||||
<li><strong>Min Litre Price:</strong> {{ summary.min_price|floatformat:3|default:"0.000" }} €</li>
|
||||
<li><strong>Max Litre Price:</strong> {{ summary.max_price|floatformat:3|default:"0.000" }} €</li>
|
||||
<li><strong>Trips:</strong> {{ month_kilometers }} km</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
45
main/templates/main/monthly_trips.html
Normal file
45
main/templates/main/monthly_trips.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load extra_tags %}
|
||||
|
||||
<!-- Title -->
|
||||
{% block title %} Monthly trips {% endblock %}
|
||||
|
||||
<!-- Content -->
|
||||
{% block content %}
|
||||
|
||||
<div class="uk-container uk-margin-top">
|
||||
<h2>Monthly trips</h2>
|
||||
|
||||
<div class="uk-overflow-auto">
|
||||
<table class="uk-table uk-table-striped uk-table-hover uk-table-small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Month</th>
|
||||
{% for year in years %}
|
||||
<th>{{ year }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for month_num in 1|to_range:12 %}
|
||||
<tr>
|
||||
<td><strong>{{ month_names|dict_get:month_num }}</strong></td>
|
||||
{% for year in years %}
|
||||
<td>{{ table_data|dict_get:month_num|dict_get:year }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr class="uk-background-muted">
|
||||
<td><strong>Total (km)</strong></td>
|
||||
{% for year in years %}
|
||||
<td><strong>{{ year_totals|dict_get:year }}</strong></td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue