Compare commits
No commits in common. "75df57f42a62cd4cad477e447218f27e37292506" and "45b47dd1bac80335fece6ebfe34d41f0843ebadd" have entirely different histories.
75df57f42a
...
45b47dd1ba
5 changed files with 3 additions and 71 deletions
|
@ -52,9 +52,7 @@
|
|||
{% regroup history.data by month.year as years_list %}
|
||||
{% for y, year in years_list reversed %}
|
||||
<tr>
|
||||
<th>
|
||||
<a href="{% url "transaction_year" y %}">{{ y }}</a>
|
||||
</th>
|
||||
<th>{{ y }}</th>
|
||||
{% for m in year %}
|
||||
{% if forloop.parentloop.last and forloop.first %}
|
||||
{% empty_calendar_cells_start m.month.month %}
|
||||
|
|
|
@ -66,10 +66,8 @@ table.full-width col.bar {
|
|||
}
|
||||
}
|
||||
|
||||
.history & tbody tr {
|
||||
background: initial;
|
||||
}
|
||||
tbody tr {
|
||||
background: initial;
|
||||
&.empty {
|
||||
height: 0.5rem;
|
||||
}
|
||||
|
|
|
@ -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 %}
|
|
@ -4,11 +4,6 @@ from . import views
|
|||
|
||||
urlpatterns = [
|
||||
path("list", views.TransactionListView.as_view(), name="transactions"),
|
||||
path(
|
||||
"history/<int:year>",
|
||||
views.TransactionYearView.as_view(),
|
||||
name="transaction_year",
|
||||
),
|
||||
path(
|
||||
"history/<int:year>/<int:month>",
|
||||
views.TransactionMonthView.as_view(),
|
||||
|
|
|
@ -2,8 +2,7 @@ from account.models import Account
|
|||
from category.models import Category
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic.dates import MonthArchiveView, YearArchiveView
|
||||
from history.utils import history
|
||||
from django.views.generic.dates import MonthArchiveView
|
||||
from main.views import (
|
||||
NummiCreateView,
|
||||
NummiDeleteView,
|
||||
|
@ -139,39 +138,3 @@ class TransactionMonthView(UserMixin, MonthArchiveView):
|
|||
if "account" in self.kwargs:
|
||||
return context_data | {"account": self.account}
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue