Changes to payment models #32
13
src/accounting/templates/accounting/order/detail.html
Normal file
13
src/accounting/templates/accounting/order/detail.html
Normal 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
38
src/accounting/views.py
Normal 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,
|
||||||
|
)
|
Loading…
Reference in a new issue