Compare commits

..

No commits in common. "2f32c2b80f279d4c2c0060d10090e22e0d950094" and "8b9af8e1a487fe5187b2fada243656e9e2eda4b0" have entirely different histories.

7 changed files with 15 additions and 51 deletions

View file

@ -1,6 +1,6 @@
from django.urls import path
from statement.views import StatementCreateView
from transaction.views import TransactionMonthView, TransactionYearView
from transaction.views import TransactionMonthView
from . import views
@ -27,11 +27,6 @@ urlpatterns = [
views.AccountDeleteView.as_view(),
name="del_account",
),
path(
"<account>/history/<int:year>",
TransactionYearView.as_view(),
name="account_transaction_year",
),
path(
"<account>/history/<int:year>/<int:month>",
TransactionMonthView.as_view(),

View file

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

View file

@ -6,8 +6,6 @@ from django.urls import reverse
from django.utils.safestring import mark_safe
from main.templatetags.main_extras import pmrvalue, remix
from ..utils import ac_url
register = template.Library()
@ -40,23 +38,21 @@ def up_down_icon(val):
@register.simple_tag
def month_url(month, **kwargs):
url_name, url_params = ac_url(
"transaction_month", {"year": month.year, "month": month.month}, **kwargs
)
def month_url(month, account=None, category=None):
url_name = "transaction_month"
url_params = {"year": month.year, "month": month.month}
if account:
url_name = "account_" + url_name
url_params |= {"account": account.pk}
elif category:
url_name = "category_" + url_name
url_params |= {"category": category.pk}
url = reverse(url_name, kwargs=url_params)
return mark_safe(f"""<a href="{url}">{ date(month, "Y-m") }</a>""")
@register.simple_tag
def year_url(year, **kwargs):
url_name, url_params = ac_url("transaction_year", {"year": year}, **kwargs)
url = reverse(url_name, kwargs=url_params)
return mark_safe(f"""<a href="{url}">{ year }</a>""")
@register.simple_tag
def plot_bar(s, sum_pm, s_max):
_res = ""

View file

@ -50,14 +50,3 @@ def history(transaction_set):
"sum": _history.aggregate(max=Max(Abs("sum")))["max"],
},
}
def ac_url(url_name, url_params, account=None, category=None):
if account:
url_name = "account_" + url_name
url_params |= {"account": account.pk}
elif category:
url_name = "category_" + url_name
url_params |= {"category": category.pk}
return url_name, url_params

View file

@ -20,16 +20,3 @@
{% endwith %}
</p>
{% endif %}
{% if year %}
<p class="pagination">
{% with year=previous_year %}
{% include "main/pagination_year.html" %}
{% endwith %}
{% with cur=True %}
{% include "main/pagination_year.html" %}
{% endwith %}
{% with year=next_year %}
{% include "main/pagination_year.html" %}
{% endwith %}
</p>
{% endif %}

View file

@ -1,5 +1,5 @@
{% load i18n %}
{% if month %}
<a {% if cur %}class="cur"{% endif %}
href="{% if account %}{% url "account_transaction_month" account.id month.year month.month %}{% elif category %}{% url "category_transaction_month" category.id month.year month.month %}{% else %}{% url "transaction_month" month.year month.month %}{% endif %}">{{ month|date:"F Y"|capfirst }}</a>
href="{% if account %}{% url "account_transaction_month" account.id month|date:"Y" month|date:"m" %}{% elif category %}{% url "category_transaction_month" category.id month|date:"Y" month|date:"m" %}{% else %}{% url "transaction_month" month|date:"Y" month|date:"m" %}{% endif %}">{{ month|date:"F Y"|capfirst }}</a>
{% endif %}

View file

@ -1,5 +0,0 @@
{% load i18n %}
{% if year %}
<a {% if cur %}class="cur"{% endif %}
href="{% if account %}{% url "account_transaction_year" account.id year.year %}{% elif category %}{% url "category_transaction_year" category.id year.year %}{% else %}{% url "transaction_year" year.year %}{% endif %}">{{ year|date:"Y" }}</a>
{% endif %}