Add snapshot form

This commit is contained in:
Edgar P. Burkhart 2022-05-22 10:06:44 +02:00
parent 4b784a553b
commit cb458cf472
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
17 changed files with 159 additions and 372 deletions

View file

@ -29,6 +29,10 @@
class="{% if request.resolver_match.url_name == "category" %} cur{% endif %}">
Add category
</a>
<a href="{% url 'snapshot' %}"
class="{% if request.resolver_match.url_name == "snapshot" %} cur{% endif %}">
Add snapshot
</a>
<a href="{% url 'logout' %}"
class="logout">
Log Out

View file

@ -55,7 +55,9 @@
</div>
{% for snap in snapshots %}
<div class="snapshot {% cycle 'w' 'g' %}">
<span class="date num center">{{ snap.date|date:"Y-m-d" }}</span>
<span class="date num center">
<a href="{% url 'snapshot' snap.date %}">{{ snap.date|date:"Y-m-d" }}</a>
</span>
<span class="value num right">{{ snap.value|floatformat:"2g" }} €</span>
<span class="diff num right">{{ snap.diff|floatformat:"2g"|pm }} €</span>
{% with sum=snap.sum %}

View file

@ -0,0 +1,26 @@
{% extends "main/base.html" %}
{% load static %}
{% block link %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'main/css/form.css' %}" type="text/css" />
{% endblock %}
{% block body %}
<h1>{{ snapshot }}</h1>
<form action="{% url 'update_snapshot' snapshot.id %}" method="post">
{% csrf_token %}
{% for field in form %}
{{ field.errors }}
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% endfor %}
<div class="buttons">
<a href="{% url 'del_snapshot' snapshot.date %}"><input type="button" value="Delete" /></a>
<input type="reset" />
<input type="submit" value="Save Snapshot" />
</div>
</form>
{% endblock %}