Bootstrap an Order detail page
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
Benjamin Bach 2024-07-28 22:39:21 +02:00
parent 5c5153adb6
commit 6bf42ecba3
No known key found for this signature in database
GPG key ID: 486F0D69C845416E
2 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,13 @@
{% extends "base.html" %}
{% load i18n %}
{% block head_title %}
{% trans "Order" %}
{% endblock %}
{% block content %}
<div class="content-view">
<h2>Order: {{ order.id }}</h2>
</div>
{% endblock %}

38
src/accounting/views.py Normal file
View file

@ -0,0 +1,38 @@
"""Views for the membership app."""
from __future__ import annotations
from typing import TYPE_CHECKING
from django.shortcuts import render
from django_view_decorator import namespaced_decorator_factory
from . import models
if TYPE_CHECKING:
from django.http import HttpRequest
from django.http import HttpResponse
order_view = namespaced_decorator_factory(namespace="order", base_path="order")
@order_view(
paths="<int:order_id>/",
name="detail",
login_required=True,
)
def order_detail(request: HttpRequest, order_id: int) -> HttpResponse:
"""View to show the details of a member."""
user = request.user # People just need to login to pay something, not necessarily be a member
order = models.Order.objects.get(pk=order_id, member=user)
context = {
"order": order,
}
return render(
request=request,
template_name="accounting/order/detail.html",
context=context,
)