Add a link for unpaid orders, disable the "zen" of not being able to code fast
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
This commit is contained in:
parent
3e66a8fd32
commit
04f9ac7935
|
@ -14,6 +14,10 @@
|
||||||
It is very much under construction.
|
It is very much under construction.
|
||||||
</p>
|
</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 %}
|
{% comment %}
|
||||||
<hr>
|
<hr>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from accounting.models import Order
|
||||||
from django_view_decorator import view
|
from django_view_decorator import view
|
||||||
from utils.view_utils import render
|
from utils.view_utils import render
|
||||||
|
|
||||||
|
@ -19,7 +20,11 @@ if TYPE_CHECKING:
|
||||||
)
|
)
|
||||||
def index(request: HttpRequest) -> HttpResponse:
|
def index(request: HttpRequest) -> HttpResponse:
|
||||||
"""View to show the index page."""
|
"""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(
|
||||||
|
|
|
@ -10,9 +10,11 @@ from typing import Any
|
||||||
from django.contrib.sites.shortcuts import get_current_site
|
from django.contrib.sites.shortcuts import get_current_site
|
||||||
from django.core.exceptions import FieldError
|
from django.core.exceptions import FieldError
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
|
from django.shortcuts import render as django_render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from zen_queries import queries_disabled
|
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:
|
if TYPE_CHECKING:
|
||||||
from django.db.models import Model
|
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.
|
# otherwise django-zen-queries will complain about database queries.
|
||||||
request.user.get_all_permissions()
|
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)
|
||||||
|
|
Loading…
Reference in a new issue