Compare commits

..

No commits in common. "75df57f42a62cd4cad477e447218f27e37292506" and "45b47dd1bac80335fece6ebfe34d41f0843ebadd" have entirely different histories.

5 changed files with 3 additions and 71 deletions

View file

@ -52,9 +52,7 @@
{% regroup history.data by month.year as years_list %} {% regroup history.data by month.year as years_list %}
{% for y, year in years_list reversed %} {% for y, year in years_list reversed %}
<tr> <tr>
<th> <th>{{ y }}</th>
<a href="{% url "transaction_year" y %}">{{ y }}</a>
</th>
{% for m in year %} {% for m in year %}
{% if forloop.parentloop.last and forloop.first %} {% if forloop.parentloop.last and forloop.first %}
{% empty_calendar_cells_start m.month.month %} {% empty_calendar_cells_start m.month.month %}

View file

@ -66,10 +66,8 @@ table.full-width col.bar {
} }
} }
.history & tbody tr {
background: initial;
}
tbody tr { tbody tr {
background: initial;
&.empty { &.empty {
height: 0.5rem; height: 0.5rem;
} }

View file

@ -1,22 +0,0 @@
{% extends "main/list.html" %}
{% load i18n main_extras static category %}
{% block link %}
{{ block.super }}
{% css "main/css/plot.css" %}
{% endblock %}
{% block name %}{{ year|date:"Y" }}{% endblock %}
{% block h2 %}{{ year|date:"Y" }}{% endblock %}
{% block table %}
{% if history %}
<section>
<h3>
{% translate "History" %}
</h2>
{% include "history/plot.html" %}
</section>
{% endif %}
{% if not category %}
<h3>{% translate "Categories" %}</h3>
{% category_plot transactions month=month %}
{% endif %}
{% endblock %}

View file

@ -4,11 +4,6 @@ from . import views
urlpatterns = [ urlpatterns = [
path("list", views.TransactionListView.as_view(), name="transactions"), path("list", views.TransactionListView.as_view(), name="transactions"),
path(
"history/<int:year>",
views.TransactionYearView.as_view(),
name="transaction_year",
),
path( path(
"history/<int:year>/<int:month>", "history/<int:year>/<int:month>",
views.TransactionMonthView.as_view(), views.TransactionMonthView.as_view(),

View file

@ -2,8 +2,7 @@ from account.models import Account
from category.models import Category from category.models import Category
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.views.generic.dates import MonthArchiveView, YearArchiveView from django.views.generic.dates import MonthArchiveView
from history.utils import history
from main.views import ( from main.views import (
NummiCreateView, NummiCreateView,
NummiDeleteView, NummiDeleteView,
@ -139,39 +138,3 @@ class TransactionMonthView(UserMixin, MonthArchiveView):
if "account" in self.kwargs: if "account" in self.kwargs:
return context_data | {"account": self.account} return context_data | {"account": self.account}
return context_data return context_data
class TransactionYearView(UserMixin, YearArchiveView):
model = Transaction
date_field = "date"
context_object_name = "transactions"
make_object_list = True
def get_queryset(self):
if "account" in self.kwargs:
self.account = get_object_or_404(
Account.objects.filter(user=self.request.user),
pk=self.kwargs["account"],
)
return super().get_queryset().filter(account=self.account)
if "category" in self.kwargs:
self.category = get_object_or_404(
Category.objects.filter(user=self.request.user),
pk=self.kwargs["category"],
)
return super().get_queryset().filter(category=self.category)
return super().get_queryset()
def get_context_data(self, **kwargs):
context_data = super().get_context_data(**kwargs)
context_data |= {
"history": history(
context_data["transactions"].exclude(category__budget=False)
),
}
if "category" in self.kwargs:
return context_data | {"category": self.category}
if "account" in self.kwargs:
return context_data | {"account": self.account}
return context_data