mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-02-26 01:14:50 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27d448afd6 | ||
|
|
1dd90974bd | ||
|
|
31cc8db3ac | ||
|
|
3d85a15ec9 | ||
|
|
90f98c2d15 | ||
|
|
643855e60e | ||
|
|
e0f7b532f8 | ||
|
|
b4d3e4b42f | ||
|
|
9a7ccb0973 | ||
|
|
a9b67ff272 | ||
|
|
233b9629a2 | ||
|
|
4180c177f1 | ||
|
|
f1bc04756f |
@@ -13,4 +13,9 @@ urlpatterns = [
|
||||
views.month_year_picker,
|
||||
name="month_year_picker",
|
||||
),
|
||||
path(
|
||||
"cache/invalidate/",
|
||||
views.invalidate_cache,
|
||||
name="invalidate_cache",
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,17 +1,32 @@
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db.models import Count
|
||||
from django.db.models.functions import ExtractYear, ExtractMonth
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from cachalot.api import invalidate
|
||||
|
||||
from apps.common.decorators.htmx import only_htmx
|
||||
from apps.transactions.models import Transaction
|
||||
|
||||
|
||||
@only_htmx
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def toasts(request):
|
||||
return render(request, "common/fragments/toasts.html")
|
||||
|
||||
|
||||
@only_htmx
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def month_year_picker(request):
|
||||
field = request.GET.get("field", "reference_date")
|
||||
for_ = request.GET.get("for", None)
|
||||
@@ -84,3 +99,19 @@ def month_year_picker(request):
|
||||
"current_year": current_year,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@only_htmx
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def invalidate_cache(request):
|
||||
invalidate()
|
||||
|
||||
messages.success(request, _("Cache cleared successfully"))
|
||||
|
||||
return HttpResponse(
|
||||
status=204,
|
||||
headers={
|
||||
"HX-Trigger": "updated",
|
||||
},
|
||||
)
|
||||
|
||||
@@ -49,7 +49,7 @@ class SoftDeleteQuerySet(models.QuerySet):
|
||||
class SoftDeleteManager(models.Manager):
|
||||
def get_queryset(self):
|
||||
qs = SoftDeleteQuerySet(self.model, using=self._db)
|
||||
return qs if not settings.ENABLE_SOFT_DELETE else qs.filter(deleted=False)
|
||||
return qs.filter(deleted=False)
|
||||
|
||||
|
||||
class AllObjectsManager(models.Manager):
|
||||
@@ -60,7 +60,7 @@ class AllObjectsManager(models.Manager):
|
||||
class DeletedObjectsManager(models.Manager):
|
||||
def get_queryset(self):
|
||||
qs = SoftDeleteQuerySet(self.model, using=self._db)
|
||||
return qs if not settings.ENABLE_SOFT_DELETE else qs.filter(deleted=True)
|
||||
return qs.filter(deleted=True)
|
||||
|
||||
|
||||
class TransactionCategory(models.Model):
|
||||
|
||||
@@ -27,7 +27,7 @@ def generate_recurring_transactions(timestamp=None):
|
||||
|
||||
@app.periodic(cron="10 1 * * *")
|
||||
@app.task
|
||||
def cleanup_deleted_transactions():
|
||||
def cleanup_deleted_transactions(timestamp=None):
|
||||
with cachalot_disabled():
|
||||
if settings.ENABLE_SOFT_DELETE and settings.KEEP_DELETED_TRANSACTIONS_FOR == 0:
|
||||
return "KEEP_DELETED_TRANSACTIONS_FOR is 0, no cleanup performed."
|
||||
@@ -44,7 +44,7 @@ def cleanup_deleted_transactions():
|
||||
days=settings.KEEP_DELETED_TRANSACTIONS_FOR
|
||||
)
|
||||
|
||||
invalidate("transactions.Transaction")
|
||||
invalidate()
|
||||
|
||||
# Hard delete soft-deleted transactions older than the cutoff date
|
||||
old_transactions = Transaction.deleted_objects.filter(deleted_at__lt=cutoff_date)
|
||||
|
||||
2319
app/locale/de/LC_MESSAGES/django.po
Normal file
2319
app/locale/de/LC_MESSAGES/django.po
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-01-27 16:26+0000\n"
|
||||
"POT-Creation-Date: 2025-01-28 00:49+0000\n"
|
||||
"PO-Revision-Date: 2025-01-27 13:27-0300\n"
|
||||
"Last-Translator: Herculino Trotta\n"
|
||||
"Language-Team: \n"
|
||||
@@ -322,6 +322,12 @@ msgstr "Fout"
|
||||
msgid "Info"
|
||||
msgstr "Info"
|
||||
|
||||
#: apps/common/views.py:110
|
||||
#, fuzzy
|
||||
#| msgid "Category updated successfully"
|
||||
msgid "Cache cleared successfully"
|
||||
msgstr "Categorie succesvol bijgewerkt"
|
||||
|
||||
#: apps/common/widgets/datepicker.py:47 apps/common/widgets/datepicker.py:186
|
||||
msgid "Today"
|
||||
msgstr "Vandaag"
|
||||
@@ -1899,7 +1905,13 @@ msgstr "Rekenmachine"
|
||||
msgid "Settings"
|
||||
msgstr "Instellingen"
|
||||
|
||||
#: templates/includes/navbar/user_menu.html:37
|
||||
#: templates/includes/navbar/user_menu.html:38
|
||||
#, fuzzy
|
||||
#| msgid "Clear"
|
||||
msgid "Clear cache"
|
||||
msgstr "Leegmaken"
|
||||
|
||||
#: templates/includes/navbar/user_menu.html:42
|
||||
msgid "Logout"
|
||||
msgstr "Uitloggen"
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-01-27 16:26+0000\n"
|
||||
"PO-Revision-Date: 2025-01-27 13:27-0300\n"
|
||||
"POT-Creation-Date: 2025-01-28 00:49+0000\n"
|
||||
"PO-Revision-Date: 2025-01-27 21:49-0300\n"
|
||||
"Last-Translator: Herculino Trotta\n"
|
||||
"Language-Team: \n"
|
||||
"Language: pt_BR\n"
|
||||
@@ -320,6 +320,10 @@ msgstr "Erro"
|
||||
msgid "Info"
|
||||
msgstr "Informação"
|
||||
|
||||
#: apps/common/views.py:110
|
||||
msgid "Cache cleared successfully"
|
||||
msgstr "Cache limpo com sucesso"
|
||||
|
||||
#: apps/common/widgets/datepicker.py:47 apps/common/widgets/datepicker.py:186
|
||||
msgid "Today"
|
||||
msgstr "Hoje"
|
||||
@@ -1898,7 +1902,11 @@ msgstr "Calculadora"
|
||||
msgid "Settings"
|
||||
msgstr "Configurações"
|
||||
|
||||
#: templates/includes/navbar/user_menu.html:37
|
||||
#: templates/includes/navbar/user_menu.html:38
|
||||
msgid "Clear cache"
|
||||
msgstr "Limpar cache"
|
||||
|
||||
#: templates/includes/navbar/user_menu.html:42
|
||||
msgid "Logout"
|
||||
msgstr "Sair"
|
||||
|
||||
|
||||
@@ -39,23 +39,23 @@
|
||||
{% for transaction in date.transactions %}
|
||||
{% if transaction.is_paid %}
|
||||
{% if transaction.type == "IN" and not transaction.account.is_asset %}
|
||||
<i class="fa-solid fa-circle-check tw-text-green-400" data-bs-toggle="tooltip" data-bs-title="{{ transaction.description }}"></i>
|
||||
<i class="fa-solid fa-circle-check tw-text-green-400" data-bs-toggle="tooltip" data-bs-title="{% if transaction.description %}{{ transaction.description }}{% else %}{% trans 'Income' %}{% endif %}"></i>
|
||||
{% elif transaction.type == "IN" and transaction.account.is_asset %}
|
||||
<i class="fa-solid fa-circle-check tw-text-green-300" data-bs-toggle="tooltip" data-bs-title="{{ transaction.description }}"></i>
|
||||
<i class="fa-solid fa-circle-check tw-text-green-300" data-bs-toggle="tooltip" data-bs-title="{% if transaction.description %}{{ transaction.description }}{% else %}{% trans 'Income' %}{% endif %}"></i>
|
||||
{% elif transaction.type == "EX" and not transaction.account.is_asset %}
|
||||
<i class="fa-solid fa-circle-check tw-text-red-400" data-bs-toggle="tooltip" data-bs-title="{{ transaction.description }}"></i>
|
||||
<i class="fa-solid fa-circle-check tw-text-red-400" data-bs-toggle="tooltip" data-bs-title="{% if transaction.description %}{{ transaction.description }}{% else %}{% trans 'Expense' %}{% endif %}"></i>
|
||||
{% elif transaction.type == "EX" and transaction.account.is_asset %}
|
||||
<i class="fa-solid fa-circle-check tw-text-red-300" data-bs-toggle="tooltip" data-bs-title="{{ transaction.description }}"></i>
|
||||
<i class="fa-solid fa-circle-check tw-text-red-300" data-bs-toggle="tooltip" data-bs-title="{% if transaction.description %}{{ transaction.description }}{% else %}{% trans 'Expense' %}{% endif %}"></i>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if transaction.type == "IN" and not transaction.account.is_asset %}
|
||||
<i class="fa-regular fa-circle tw-text-green-400" data-bs-toggle="tooltip" data-bs-title="{{ transaction.description }}"></i>
|
||||
<i class="fa-regular fa-circle tw-text-green-400" data-bs-toggle="tooltip" data-bs-title="{% if transaction.description %}{{ transaction.description }}{% else %}{% trans 'Income' %}{% endif %}"></i>
|
||||
{% elif transaction.type == "IN" and transaction.account.is_asset %}
|
||||
<i class="fa-regular fa-circle tw-text-green-300" data-bs-toggle="tooltip" data-bs-title="{{ transaction.description }}"></i>
|
||||
<i class="fa-regular fa-circle tw-text-green-300" data-bs-toggle="tooltip" data-bs-title="{% if transaction.description %}{{ transaction.description }}{% else %}{% trans 'Income' %}{% endif %}"></i>
|
||||
{% elif transaction.type == "EX" and not transaction.account.is_asset %}
|
||||
<i class="fa-regular fa-circle tw-text-red-400" data-bs-toggle="tooltip" data-bs-title="{{ transaction.description }}"></i>
|
||||
<i class="fa-regular fa-circle tw-text-red-400" data-bs-toggle="tooltip" data-bs-title="{% if transaction.description %}{{ transaction.description }}{% else %}{% trans 'Expense' %}{% endif %}"></i>
|
||||
{% elif transaction.type == "EX" and transaction.account.is_asset %}
|
||||
<i class="fa-regular fa-circle tw-text-green-300" data-bs-toggle="tooltip" data-bs-title="{{ transaction.description }}"></i>
|
||||
<i class="fa-regular fa-circle tw-text-red-300" data-bs-toggle="tooltip" data-bs-title="{% if transaction.description %}{{ transaction.description }}{% else %}{% trans 'Expense' %}{% endif %}"></i>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
{% block title %}{% translate 'Transactions on' %} {{ date|date:"SHORT_DATE_FORMAT" }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div hx-get="{% url 'calendar_transactions_list' day=date.day month=date.month year=date.year %}" hx-trigger="updated from:window" hx-vals='{"disable_selection": true}' hx-target="closest .offcanvas" class="show-loading">
|
||||
{% for transaction in transactions %}
|
||||
<c-transaction.item
|
||||
:transaction="transaction"
|
||||
:disable-selection="True"></c-transaction.item>
|
||||
{% empty %}
|
||||
<c-msg.empty
|
||||
title="{% translate 'No transactions on this date' %}"></c-msg.empty>
|
||||
{% endfor %}
|
||||
<div hx-get="{% url 'calendar_transactions_list' day=date.day month=date.month year=date.year %}" hx-trigger="updated from:window" hx-vals='{"disable_selection": true}' hx-target="closest .offcanvas" class="show-loading" id="transactions-list">
|
||||
{% for transaction in transactions %}
|
||||
<c-transaction.item :transaction="transaction"></c-transaction.item>
|
||||
{% empty %}
|
||||
<c-msg.empty
|
||||
title="{% translate 'No transactions on this date' %}"></c-msg.empty>
|
||||
{% endfor %}
|
||||
{# Floating bar #}
|
||||
<c-ui.transactions-action-bar></c-ui.transactions-action-bar>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
</li>
|
||||
{% endspaceless %}
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li>
|
||||
<a class="dropdown-item" hx-get="{% url 'invalidate_cache' %}" role="button">
|
||||
<i class="fa-solid fa-broom me-2 fa-fw"></i>{% translate 'Clear cache' %}
|
||||
</a>
|
||||
</li>
|
||||
<li><a class="dropdown-item" href="{% url 'logout' %}"><i class="fa-solid fa-door-open me-2 fa-fw"></i
|
||||
>{% translate 'Logout' %}</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
{% block title %}{% translate 'Installments' %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div hx-get="{% url 'installment_plan_transactions' installment_plan_id=installment_plan.id %}" hx-trigger="updated from:window" hx-vals='{"disable_selection": true}' hx-target="closest .offcanvas" class="show-loading">
|
||||
{% for transaction in transactions %}
|
||||
<c-transaction.item
|
||||
:transaction="transaction"
|
||||
:disable-selection="True"></c-transaction.item>
|
||||
{% endfor %}
|
||||
<div hx-get="{% url 'installment_plan_transactions' installment_plan_id=installment_plan.id %}" hx-trigger="updated from:window" hx-vals='{"disable_selection": true}' hx-target="closest .offcanvas" class="show-loading" id="transactions-list">
|
||||
{% for transaction in transactions %}
|
||||
<c-transaction.item :transaction="transaction"></c-transaction.item>
|
||||
{% endfor %}
|
||||
{# Floating bar #}
|
||||
<c-ui.transactions-action-bar></c-ui.transactions-action-bar>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
<div id="content">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
{% include 'includes/toasts.html' %}
|
||||
|
||||
{% include 'includes/scripts.html' %}
|
||||
{% block extra_js %}{% endblock %}
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
{% block title %}{% translate 'Transactions' %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div hx-get="{% url 'recurring_transaction_transactions' recurring_transaction_id=recurring_transaction.id %}" hx-trigger="updated from:window" hx-vals='{"disable_selection": true}' hx-target="closest .offcanvas" class="show-loading">
|
||||
{% for transaction in transactions %}
|
||||
<c-transaction.item
|
||||
:transaction="transaction"
|
||||
:disable-selection="True"></c-transaction.item>
|
||||
{% endfor %}
|
||||
<div hx-get="{% url 'recurring_transaction_transactions' recurring_transaction_id=recurring_transaction.id %}" hx-trigger="updated from:window" hx-vals='{"disable_selection": true}' hx-target="closest .offcanvas" class="show-loading" id="transactions-list">
|
||||
{% for transaction in transactions %}
|
||||
<c-transaction.item :transaction="transaction"></c-transaction.item>
|
||||
{% endfor %}
|
||||
{# Floating bar #}
|
||||
<c-ui.transactions-action-bar></c-ui.transactions-action-bar>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user