[paperwork] Add very basic per-member certification view

This commit is contained in:
Adam Goldsmith 2022-02-15 17:12:06 -05:00
parent c23397c102
commit f3a262f56f
4 changed files with 55 additions and 1 deletions

View File

@ -23,6 +23,7 @@ urlpatterns = [
path("", lambda request: redirect("/tasks/"), name="root"),
path("tasks/", include("tasks.urls")),
path("rentals/", include("rentals.urls")),
path("paperwork/", include("paperwork.urls")),
path("admin/", admin.site.urls),
path(
"auth/",

View File

@ -0,0 +1,31 @@
{% extends "base.dj.html" %}
{% block content %}
<p>
You have been issued the following Claremont MakerSpace Member Certifications:
</p>
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover" border="1">
<thead>
<tr>
<th>Certification</th>
<th>Version</th>
<th>Department</th>
<th>Certified By</th>
<th>Date</th>
</tr>
</thead>
<tbody>
{% for certification in certifications %}
<tr>
<td>{{ certification.certification_version.definition.certification_name }}</td>
<td>{{ certification.certification_version.version }}</td>
<td>{{ certification.certification_version.definition.department }}</td>
<td>{{ certification.certified_by }}</td>
<td>{{ certification.date }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

13
paperwork/urls.py Normal file
View File

@ -0,0 +1,13 @@
from django.urls import path
from . import views
app_name = "paperwork"
urlpatterns = [
path(
"certifications/by_uid/<str:uid>",
views.member_certifications,
name="member_certifications",
),
]

View File

@ -1,3 +1,12 @@
from django.shortcuts import render
# Create your views here.
from membershipworks.models import Member
from .models import Certification
def member_certifications(request, uid: str):
context = {
"member": Member.objects.get(uid=uid),
"certifications": Certification.objects.filter(member_id=uid),
}
return render(request, "paperwork/member_certifications.dj.html", context)