Fix add snapshot page

This commit is contained in:
Edgar P. Burkhart 2022-05-24 20:46:05 +02:00
parent a911b324b5
commit 63c7ab497e
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 22 additions and 19 deletions

View file

@ -32,6 +32,7 @@
</div> </div>
</form> </form>
{% if categories %}
<h2>Plot</h2> <h2>Plot</h2>
<div class="chart"> <div class="chart">
{% for cat in categories %} {% for cat in categories %}
@ -83,6 +84,7 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
{% if snapshot.transactions %} {% if snapshot.transactions %}
<h2>Transactions ({{ sum|pmvalue }} / {{ snapshot.diff|pmvalue }})</h2> <h2>Transactions ({{ sum|pmvalue }} / {{ snapshot.diff|pmvalue }})</h2>

View file

@ -163,6 +163,7 @@ def snapshot(request, uuid=None):
"form": _form, "form": _form,
} }
if _snapshot.transactions:
context["categories"] = ( context["categories"] = (
_snapshot.transactions.values("category", "category__name", "category__icon") _snapshot.transactions.values("category", "category__name", "category__icon")
.annotate( .annotate(