summaryrefslogtreecommitdiff
path: root/app/budget
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2025-01-03 18:46:40 -0600
committerluxagraf <sng@luxagraf.net>2025-01-03 18:46:40 -0600
commitfe7d43f308bbc3953d4a88480b8088d12cbcb0b6 (patch)
tree3aa10d1ac8e041ad2b78a5acf6b29febad6a5fe3 /app/budget
parentdf3bc581e496412ef8c263dbf1cfe00f184e4e59 (diff)
archived old not used apps
Diffstat (limited to 'app/budget')
-rw-r--r--app/budget/0007_luxpurchase_cat.py20
-rw-r--r--app/budget/admin.py32
-rw-r--r--app/budget/migrations/0001_initial.py36
-rw-r--r--app/budget/migrations/0002_alter_luxpurchase_amount.py18
-rw-r--r--app/budget/migrations/0003_alter_luxpurchase_category_alter_luxpurchase_source.py23
-rw-r--r--app/budget/migrations/0004_alter_luxpurchase_source.py19
-rw-r--r--app/budget/migrations/0005_luxspendingcategory_luxfixedmonthly.py33
-rw-r--r--app/budget/migrations/0006_remove_luxfixedmonthly_cat_and_more.py23
-rw-r--r--app/budget/migrations/0007_luxpurchase_cat.py19
-rw-r--r--app/budget/migrations/0008_remove_luxpurchase_category.py17
-rw-r--r--app/budget/migrations/0009_rename_cat_luxpurchase_category.py18
-rw-r--r--app/budget/migrations/0010_luxfixedmonthly_amount.py18
-rw-r--r--app/budget/migrations/0011_luxpaymentmethod_alter_luxfixedmonthly_amount_and_more.py31
-rw-r--r--app/budget/migrations/__init__.py0
-rw-r--r--app/budget/models.py80
-rw-r--r--app/budget/templates/budget/base.html35
-rw-r--r--app/budget/templates/budget/create_cat_form.html26
-rw-r--r--app/budget/templates/budget/create_form.html26
-rw-r--r--app/budget/templates/budget/luxpurchase_list.html58
-rw-r--r--app/budget/templates/budget/update_form.html20
-rw-r--r--app/budget/urls.py29
-rw-r--r--app/budget/views.py57
22 files changed, 0 insertions, 638 deletions
diff --git a/app/budget/0007_luxpurchase_cat.py b/app/budget/0007_luxpurchase_cat.py
deleted file mode 100644
index b7bb553..0000000
--- a/app/budget/0007_luxpurchase_cat.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-12 12:53
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0006_remove_luxfixedmonthly_cat_and_more'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='luxpurchase',
- name='cat',
- field=models.ForeignKey(default='Grocery & Home', on_delete=django.db.models.deletion.CASCADE, to='budget.luxspendingcategory'),
- preserve_default=False,
- ),
- ]
diff --git a/app/budget/admin.py b/app/budget/admin.py
deleted file mode 100644
index 0f578fb..0000000
--- a/app/budget/admin.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from django.contrib import admin
-from .models import LuxSource, LuxPurchase, LuxSpendingCategory, LuxFixedMonthly, LuxPaymentMethod
-
-
-@admin.register(LuxSpendingCategory)
-class SourceAdmin(admin.ModelAdmin):
- list_display = ('name',)
-
-
-@admin.register(LuxSource)
-class SourceAdmin(admin.ModelAdmin):
- list_display = ('name',)
-
-
-@admin.register(LuxPurchase)
-class PurchaseAdmin(admin.ModelAdmin):
- list_display = ('source', 'amount', 'category' )
- search_fields = ['source', 'amount']
- list_filter = ('category',)
-
- class Media:
- js = ('next-prev-links.js',)
-
-
-@admin.register(LuxFixedMonthly)
-class LuxFixedMonthlyAdmin(admin.ModelAdmin):
- list_display = ('name', 'amount', 'category', 'payment_method')
-
-
-@admin.register(LuxPaymentMethod)
-class LuxPaymentMethodAdmin(admin.ModelAdmin):
- list_display = ('name',)
diff --git a/app/budget/migrations/0001_initial.py b/app/budget/migrations/0001_initial.py
deleted file mode 100644
index 30bd5a1..0000000
--- a/app/budget/migrations/0001_initial.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-11 17:50
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ]
-
- operations = [
- migrations.CreateModel(
- name='LuxSource',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=200)),
- ('date_recorded', models.DateTimeField(auto_now_add=True)),
- ],
- ),
- migrations.CreateModel(
- name='LuxPurchase',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('amount', models.IntegerField()),
- ('category', models.IntegerField(choices=[(0, 'Grocery and Home'), (1, 'Gas'), (2, 'Bus'), (3, 'Lodging'), (4, 'Books'), (5, 'Clothes'), (6, 'Eating Out'), (7, 'Misc')], default=0)),
- ('date_recorded', models.DateTimeField(auto_now_add=True)),
- ('source', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='budget.luxsource')),
- ],
- options={
- 'ordering': ('-date_recorded',),
- },
- ),
- ]
diff --git a/app/budget/migrations/0002_alter_luxpurchase_amount.py b/app/budget/migrations/0002_alter_luxpurchase_amount.py
deleted file mode 100644
index 06400dd..0000000
--- a/app/budget/migrations/0002_alter_luxpurchase_amount.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-11 18:06
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0001_initial'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='luxpurchase',
- name='amount',
- field=models.DecimalField(decimal_places=2, max_digits=6),
- ),
- ]
diff --git a/app/budget/migrations/0003_alter_luxpurchase_category_alter_luxpurchase_source.py b/app/budget/migrations/0003_alter_luxpurchase_category_alter_luxpurchase_source.py
deleted file mode 100644
index a880acf..0000000
--- a/app/budget/migrations/0003_alter_luxpurchase_category_alter_luxpurchase_source.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-12 10:18
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0002_alter_luxpurchase_amount'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='luxpurchase',
- name='category',
- field=models.IntegerField(choices=[(0, 'Grocery & Home'), (1, 'Gas'), (2, 'Bus'), (3, 'Lodging'), (4, 'Books'), (5, 'Clothes'), (6, 'Eating Out'), (7, 'Misc')], default=0),
- ),
- migrations.AlterField(
- model_name='luxpurchase',
- name='source',
- field=models.IntegerField(choices=[(0, 'Walmart'), (1, 'Grocery Store'), (2, 'Gas Station'), (3, 'Amazon')], default=0),
- ),
- ]
diff --git a/app/budget/migrations/0004_alter_luxpurchase_source.py b/app/budget/migrations/0004_alter_luxpurchase_source.py
deleted file mode 100644
index 0eab270..0000000
--- a/app/budget/migrations/0004_alter_luxpurchase_source.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-12 10:46
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0003_alter_luxpurchase_category_alter_luxpurchase_source'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='luxpurchase',
- name='source',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='budget.luxsource'),
- ),
- ]
diff --git a/app/budget/migrations/0005_luxspendingcategory_luxfixedmonthly.py b/app/budget/migrations/0005_luxspendingcategory_luxfixedmonthly.py
deleted file mode 100644
index 66af470..0000000
--- a/app/budget/migrations/0005_luxspendingcategory_luxfixedmonthly.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-12 12:52
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0004_alter_luxpurchase_source'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='LuxSpendingCategory',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=200)),
- ('date_recorded', models.DateTimeField(auto_now_add=True)),
- ],
- ),
- migrations.CreateModel(
- name='LuxFixedMonthly',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=200)),
- ('category', models.IntegerField(choices=[(0, 'Grocery & Home'), (1, 'Gas'), (2, 'Bus'), (3, 'Lodging'), (4, 'Books'), (5, 'Clothes'), (6, 'Eating Out'), (7, 'Misc')], default=0)),
- ('date_recorded', models.DateTimeField(auto_now_add=True)),
- ('cat', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='budget.luxspendingcategory')),
- ('source', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='budget.luxsource')),
- ],
- ),
- ]
diff --git a/app/budget/migrations/0006_remove_luxfixedmonthly_cat_and_more.py b/app/budget/migrations/0006_remove_luxfixedmonthly_cat_and_more.py
deleted file mode 100644
index 3631cc3..0000000
--- a/app/budget/migrations/0006_remove_luxfixedmonthly_cat_and_more.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-12 12:53
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0005_luxspendingcategory_luxfixedmonthly'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='luxfixedmonthly',
- name='cat',
- ),
- migrations.AlterField(
- model_name='luxfixedmonthly',
- name='category',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='budget.luxspendingcategory'),
- ),
- ]
diff --git a/app/budget/migrations/0007_luxpurchase_cat.py b/app/budget/migrations/0007_luxpurchase_cat.py
deleted file mode 100644
index 7a8e548..0000000
--- a/app/budget/migrations/0007_luxpurchase_cat.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-12 12:56
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0006_remove_luxfixedmonthly_cat_and_more'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='luxpurchase',
- name='cat',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='budget.luxspendingcategory'),
- ),
- ]
diff --git a/app/budget/migrations/0008_remove_luxpurchase_category.py b/app/budget/migrations/0008_remove_luxpurchase_category.py
deleted file mode 100644
index 7e2a0b9..0000000
--- a/app/budget/migrations/0008_remove_luxpurchase_category.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-12 13:15
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0007_luxpurchase_cat'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='luxpurchase',
- name='category',
- ),
- ]
diff --git a/app/budget/migrations/0009_rename_cat_luxpurchase_category.py b/app/budget/migrations/0009_rename_cat_luxpurchase_category.py
deleted file mode 100644
index c0efeff..0000000
--- a/app/budget/migrations/0009_rename_cat_luxpurchase_category.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-12 13:16
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0008_remove_luxpurchase_category'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='luxpurchase',
- old_name='cat',
- new_name='category',
- ),
- ]
diff --git a/app/budget/migrations/0010_luxfixedmonthly_amount.py b/app/budget/migrations/0010_luxfixedmonthly_amount.py
deleted file mode 100644
index 15461d4..0000000
--- a/app/budget/migrations/0010_luxfixedmonthly_amount.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-13 10:48
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0009_rename_cat_luxpurchase_category'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='luxfixedmonthly',
- name='amount',
- field=models.DecimalField(decimal_places=2, max_digits=6, null=True),
- ),
- ]
diff --git a/app/budget/migrations/0011_luxpaymentmethod_alter_luxfixedmonthly_amount_and_more.py b/app/budget/migrations/0011_luxpaymentmethod_alter_luxfixedmonthly_amount_and_more.py
deleted file mode 100644
index 4186c52..0000000
--- a/app/budget/migrations/0011_luxpaymentmethod_alter_luxfixedmonthly_amount_and_more.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Generated by Django 4.0.6 on 2022-11-13 11:11
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('budget', '0010_luxfixedmonthly_amount'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='LuxPaymentMethod',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=200)),
- ],
- ),
- migrations.AlterField(
- model_name='luxfixedmonthly',
- name='amount',
- field=models.DecimalField(decimal_places=2, max_digits=6),
- ),
- migrations.AddField(
- model_name='luxfixedmonthly',
- name='payment_method',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='budget.luxpaymentmethod'),
- ),
- ]
diff --git a/app/budget/migrations/__init__.py b/app/budget/migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/app/budget/migrations/__init__.py
+++ /dev/null
diff --git a/app/budget/models.py b/app/budget/models.py
deleted file mode 100644
index 512b019..0000000
--- a/app/budget/models.py
+++ /dev/null
@@ -1,80 +0,0 @@
-import calendar
-import datetime
-from django.db import models
-from django.db.models import Sum
-from django.urls import reverse
-from django.utils import timezone
-
-
-class LuxSource(models.Model):
- name = models.CharField(max_length=200)
- date_recorded = models.DateTimeField(auto_now_add=True)
-
- def __str__(self):
- return self.name
-
-
-class LuxSpendingCategory(models.Model):
- name = models.CharField(max_length=200)
- date_recorded = models.DateTimeField(auto_now_add=True)
-
- def __str__(self):
- return self.name
-
-
-class LuxPaymentMethod(models.Model):
- name = models.CharField(max_length=200)
-
- def __str__(self):
- return self.name
-
-
-class LuxFixedMonthly(models.Model):
- name = models.CharField(max_length=200)
- amount = models.DecimalField(max_digits=6, decimal_places=2)
- source = models.ForeignKey(LuxSource, on_delete=models.CASCADE)
- category = models.ForeignKey(LuxSpendingCategory, on_delete=models.CASCADE)
- payment_method = models.ForeignKey(LuxPaymentMethod, null=True, on_delete=models.CASCADE)
- date_recorded = models.DateTimeField(auto_now_add=True)
-
- def __str__(self):
- return self.name
-
-
-class LuxPurchaseStatsManager(models.Manager):
-
- def get_monthly_spending(self, month=timezone.now().month):
- last_day = calendar.monthrange(timezone.now().year, month)[1]
- start_date = datetime.date(timezone.now().year, month, 1)
- end_date = datetime.date(timezone.now().year, month, last_day)
- return self.filter(date_recorded__range=(start_date, end_date)).aggregate(Sum('amount'))
-
- def get_monthly_spending_by_category(self, cat, number_of_months=1):
- cat = LuxSpendingCategory.objects.get(name=cat)
- today = timezone.now()
- month = today.replace(day=1).month
- start_month = month - number_of_months + 1
- start_date = datetime.date(timezone.now().year, start_month, 1)
- last_day = calendar.monthrange(timezone.now().year, month)[1]
- end_date = datetime.date(timezone.now().year, month, last_day)
- return self.filter(date_recorded__range=(start_date, end_date)).filter(category=cat).aggregate(Sum('amount'))
-
-
-class LuxPurchase(models.Model):
- amount = models.DecimalField(max_digits=6, decimal_places=2)
- source = models.ForeignKey(LuxSource, on_delete=models.CASCADE)
- category = models.ForeignKey(LuxSpendingCategory, null=True, on_delete=models.CASCADE)
- date_recorded = models.DateTimeField(auto_now_add=True)
-
- class Meta:
- ordering = ('-date_recorded',)
-
- def __str__(self):
- return "%s - %s" %(self.amount, self.source.name)
-
- def get_absolute_url(self):
- return reverse("luxbudget:detail", kwargs={"pk": self.pk})
-
- objects = models.Manager() # The default manager.
- stats = LuxPurchaseStatsManager()
-
diff --git a/app/budget/templates/budget/base.html b/app/budget/templates/budget/base.html
deleted file mode 100644
index 9d6bfd0..0000000
--- a/app/budget/templates/budget/base.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<html>
-<head>
- <title>{% block pagetitle %}Luxagraf - Trading{% endblock %}</title>
- <meta charset="utf-8">
- <meta http-equiv="x-ua-compatible" content="ie=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- {%block stylesheet%}<link rel="stylesheet"
- href="/media/trading.css{%comment%}?{% now "u" %}{%endcomment%}"
- media="screen">{%endblock%}
- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
-<style>
- select {
- border: 1px solid #dedddd;
- border-radius: 4px;
- padding: 2.2rem 0 0.75rem 0.75rem;
- width: 96%;
- font-size: 24px;
- font-size: 1.5rem;
- }
-</style>
- {%block extrahead%}{%endblock%}
-</head>
- </head>
- <body>
- <nav>
- <span class="nav-item"><a href="{% url 'luxbudget:list' %}">Home</a></span>
- <span class="nav-item"><a href="{% url 'luxbudget:createcatview' %}">Add Cat</a></span>
- </nav>
- {% block content %}
- {% endblock %}
- </body>
- {% block js %}
- {% endblock %}
-</html>
-
diff --git a/app/budget/templates/budget/create_cat_form.html b/app/budget/templates/budget/create_cat_form.html
deleted file mode 100644
index 03e996a..0000000
--- a/app/budget/templates/budget/create_cat_form.html
+++ /dev/null
@@ -1,26 +0,0 @@
-{% extends 'budget/base.html' %}
-{% load typogrify_tags %}
- {% block pagetitle %}Luxagraf - Record Purchase{% endblock %}
- {% block content %}
- <form id="id_form" action="{% url 'luxbudget:createcatview' %}" method="post" class="big">{% csrf_token %}
- {% for field in form %}
- <fieldset>
- {{ field.errors }}
- {% if field.name == 'status'%}
- <label class="hide" for="id_status">Status:</label>{{ field }}
- {% else %}
- {{ field.label_tag }} {{ field }}
- {% endif %}
- {% if field.help_text %}
- <p class="help">{{ field.help_text|safe }}</p>
- {% endif %}
- </fieldset>
-{% endfor %}
- <div class="flex">
- <input type="submit" name="post" class="btn" value="record purchase"/>
- </div>
- </form>
- {% endblock %}
-
- {% block js %}
- {% endblock %}
diff --git a/app/budget/templates/budget/create_form.html b/app/budget/templates/budget/create_form.html
deleted file mode 100644
index 2d38acf..0000000
--- a/app/budget/templates/budget/create_form.html
+++ /dev/null
@@ -1,26 +0,0 @@
-{% extends 'budget/base.html' %}
-{% load typogrify_tags %}
- {% block pagetitle %}Luxagraf - Record Purchase{% endblock %}
- {% block content %}
- <form id="id_form" action="{% url 'luxbudget:createview' %}" method="post" class="big">{% csrf_token %}
- {% for field in form %}
- <fieldset>
- {{ field.errors }}
- {% if field.name == 'status'%}
- <label class="hide" for="id_status">Status:</label>{{ field }}
- {% else %}
- {{ field.label_tag }} {{ field }}
- {% endif %}
- {% if field.help_text %}
- <p class="help">{{ field.help_text|safe }}</p>
- {% endif %}
- </fieldset>
-{% endfor %}
- <div class="flex">
- <input type="submit" name="post" class="btn" value="record purchase"/>
- </div>
- </form>
- {% endblock %}
-
- {% block js %}
- {% endblock %}
diff --git a/app/budget/templates/budget/luxpurchase_list.html b/app/budget/templates/budget/luxpurchase_list.html
deleted file mode 100644
index c03f14d..0000000
--- a/app/budget/templates/budget/luxpurchase_list.html
+++ /dev/null
@@ -1,58 +0,0 @@
-{% extends 'budget/base.html' %}
-{% load typogrify_tags %}
- {% block pagetitle %}Luxagraf - Record Purchase{% endblock %}
- {% block content %}
- <a href="record" class="btn" >Add New</a>
- <h3>Recent Purchases</h3>
- <table>
- <thead>
- <tr>
- <th>Date</th>
- <th>Store</th>
- <th>Category</th>
- <th>Amount</th>
- </tr>
- </thead>
- {% for object in object_list %}
- <tr>
- <td><a href="{{object.get_absolute_url}}">{{object.date_recorded|date:"m/j"}}</a></td>
- <td>{{object.source.name}}</td>
- <td>{{object.category.name}}</td>
- <td>${{object.amount}}</td>
- </tr>
- {% endfor %}
- <tr>
- <td>&nbsp;</td>
- </tr>
- <tr>
- <td></td>
- <td></td>
- <td class="right">{{month}} Total:</td>
- <td>${{monthly_spending.amount__sum}}</td>
- </tr>
- <tr>
- <td></td>
- <td></td>
- <td class="right">{{month}} Food Total:</td>
- <td>${{food_total.amount__sum}}</td>
- </tr>
- <tr>
- <td></td>
- <td></td>
- <td class="right">{{month}} Lodging Total:</td>
- <td>${{lodge_total.amount__sum}}</td>
- </tr>
- </table>
-
- <h3>Previous Monthly Spending</h3>
- {{month_1}}: {{monthly_spending_1.amount__sum}}
- {{month_2}}: {{monthly_spending_2.amount__sum}}
- {{month_3}}: {{monthly_spending_3.amount__sum}}
-
-
- <h3>Spending by Category (Last 3 Months)</h3>
-
- {{cat.amount__sum}}
- {% endblock %}
-
-
diff --git a/app/budget/templates/budget/update_form.html b/app/budget/templates/budget/update_form.html
deleted file mode 100644
index b19efaa..0000000
--- a/app/budget/templates/budget/update_form.html
+++ /dev/null
@@ -1,20 +0,0 @@
-{% extends 'budget/base.html' %}
-{% load typogrify_tags %}
-{% block content %}
- <form id="id_form" action="" method="post" class="big">{% csrf_token %}
- {% for field in form %}
- <fieldset>
- {{ field.errors }}
- {% if field.name == 'status'%}
- <label class="hide" for="id_status">Status:</label>{{ field }}
- {% else %}
- {{ field.label_tag }} {{ field }}
- {% endif %}
- {% if field.help_text %}
- <p class="help">{{ field.help_text|safe }}</p>
- {% endif %}
- </fieldset>
-{% endfor %}
- <input type="submit" name="post" class="btn" value="update purchase"/>
- </form>
- {% endblock %}
diff --git a/app/budget/urls.py b/app/budget/urls.py
deleted file mode 100644
index ef7852f..0000000
--- a/app/budget/urls.py
+++ /dev/null
@@ -1,29 +0,0 @@
-from django.urls import path, re_path
-
-from . import views
-
-app_name = "luxbudget"
-
-urlpatterns = [
- path(
- 'cat',
- views.LuxSourceModelFormView.as_view(),
- name='createcatview'
- ),
- path(
- 'record',
- views.PurchaseModelFormView.as_view(),
- name='createview'
- ),
- path(
- 'purchase/<pk>',
- views.PurchaseUpdateView.as_view(),
- name='detail'
- ),
- path(
- '',
- views.LuxPurchaseListView.as_view(),
- {'page':1},
- name='list'
- ),
-]
diff --git a/app/budget/views.py b/app/budget/views.py
deleted file mode 100644
index 6a34b1e..0000000
--- a/app/budget/views.py
+++ /dev/null
@@ -1,57 +0,0 @@
-import datetime
-from django.shortcuts import render
-from django.views.generic.edit import CreateView, UpdateView
-from django.utils import timezone
-from utils.views import PaginatedListView
-from .models import LuxPurchase, LuxSource
-
-class LuxSourceModelFormView(CreateView):
- model = LuxSource
- fields = ['name']
- success_url = '/spending/'
- template_name = 'budget/create_cat_form.html'
-
-
-class PurchaseModelFormView(CreateView):
- model = LuxPurchase
- fields = ['amount', 'source', 'category']
- success_url = '/spending/'
- template_name = 'budget/create_form.html'
-
-
-class PurchaseUpdateView(UpdateView):
- model = LuxPurchase
- fields = ['amount', 'source', 'category']
- success_url = '/spending/'
- template_name = 'budget/update_form.html'
-
-
-class LuxPurchaseListView(PaginatedListView):
- model = LuxPurchase
-
- def get_queryset(self):
- queryset = super(LuxPurchaseListView, self).get_queryset()
- return queryset[:30]
-
- def get_context_data(self, **kwargs):
- '''
- Get Monthly Spending for a nice bar chart
- '''
- # Call the base implementation first to get a context
- context = super(LuxPurchaseListView, self).get_context_data(**kwargs)
- context['monthly_spending'] = LuxPurchase.stats.get_monthly_spending()
- today = timezone.now()
- first = today.replace(day=1)
- month_1 = first - datetime.timedelta(days=1)
- month_2 = month_1.replace(day=1) - datetime.timedelta(days=1)
- month_3 = month_2.replace(day=1) - datetime.timedelta(days=1)
- context['month'] = today.strftime('%h')
- context['monthly_spending_1'] = LuxPurchase.stats.get_monthly_spending(month_1.month)
- context['month_1'] = month_1.strftime('%h')
- context['monthly_spending_2'] = LuxPurchase.stats.get_monthly_spending(month_2.month)
- context['month_2'] = month_2.strftime('%h')
- context['monthly_spending_3'] = LuxPurchase.stats.get_monthly_spending(month_3.month)
- context['month_3'] = month_3.strftime('%h')
- context['food_total'] = LuxPurchase.stats.get_monthly_spending_by_category("Grocery/Home", 1)
- context['lodge_total'] = LuxPurchase.stats.get_monthly_spending_by_category("Lodging", 1)
- return context