summaryrefslogtreecommitdiff
path: root/app/lib
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2015-03-16 22:31:32 -0400
committerluxagraf <sng@luxagraf.net>2015-03-16 22:31:32 -0400
commit50fe80969b9ddbfa795b11e303430d58a8e10a8c (patch)
tree05761e6f9347640c82efbcbd0b5658cac16cf834 /app/lib
parent60e817f397f023f71ad48742cce09670ee7abd6d (diff)
added expense tracking app
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/templatetags/templatetags/expense_total.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/lib/templatetags/templatetags/expense_total.py b/app/lib/templatetags/templatetags/expense_total.py
new file mode 100644
index 0000000..8bf0953
--- /dev/null
+++ b/app/lib/templatetags/templatetags/expense_total.py
@@ -0,0 +1,25 @@
+from decimal import Decimal
+from django import template
+from django.utils.safestring import mark_safe
+register = template.Library()
+
+@register.filter
+def expense_total(values):
+ """
+ converts spaces to hyphens.
+ """
+ total = 0
+ for items in values:
+ for item in items['list']:
+ total += Decimal(item.amount)
+ return mark_safe(total)
+
+@register.filter
+def cat_total(values):
+ """
+ converts spaces to hyphens.
+ """
+ total = 0
+ for val in values:
+ total += Decimal(val.amount)
+ return mark_safe(total)