diff --git a/src/accounting/templates/accounting/order/detail.html b/src/accounting/templates/accounting/order/detail.html new file mode 100644 index 0000000..00c5989 --- /dev/null +++ b/src/accounting/templates/accounting/order/detail.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block head_title %} + {% trans "Order" %} +{% endblock %} + +{% block content %} + +
+

Order: {{ order.id }}

+
+{% endblock %} diff --git a/src/accounting/views.py b/src/accounting/views.py new file mode 100644 index 0000000..c31c5d9 --- /dev/null +++ b/src/accounting/views.py @@ -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="/", + 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, + )