Add a link for unpaid orders, disable the "zen" of not being able to code fast

This commit is contained in:
Benjamin Bach 2024-08-12 22:37:41 +02:00
parent 3e66a8fd32
commit 04f9ac7935
No known key found for this signature in database
GPG key ID: 486F0D69C845416E
3 changed files with 15 additions and 3 deletions

View file

@ -14,6 +14,10 @@
It is very much under construction.
</p>
{% for order in unpaid_orders %}
<p>You have an unpaid order: <a href="{% url "order:detail" order_id=order.id %}">View Order ID {{ order.id }}</a></p>
{% endfor %}
{% comment %}
<hr>
<br>

View file

@ -4,6 +4,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING
from accounting.models import Order
from django_view_decorator import view
from utils.view_utils import render
@ -19,7 +20,11 @@ if TYPE_CHECKING:
)
def index(request: HttpRequest) -> HttpResponse:
"""View to show the index page."""
return render(request, "index.html")
unpaid_orders = Order.objects.filter(member=request.user)
context = {"unpaid_orders": unpaid_orders}
return render(request, "index.html", context=context)
@view(

View file

@ -10,9 +10,11 @@ from typing import Any
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import FieldError
from django.core.paginator import Paginator
from django.shortcuts import render as django_render
from django.urls import reverse
from zen_queries import queries_disabled
from zen_queries import render as zen_queries_render
# from zen_queries import render as zen_queries_render # noqa: ERA001
if TYPE_CHECKING:
from django.db.models import Model
@ -134,4 +136,5 @@ def render(request: HttpRequest, template_name: str, context: dict[str, Any] | N
# otherwise django-zen-queries will complain about database queries.
request.user.get_all_permissions()
return zen_queries_render(request, template_name, context)
# return zen_queries_render(request, template_name, context) # noqa: ERA001
return django_render(request, template_name, context)