[paperwork] Use a ListView for member certifications
This commit is contained in:
parent
f3a262f56f
commit
187e958b60
@ -7,7 +7,7 @@ app_name = "paperwork"
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path(
|
path(
|
||||||
"certifications/by_uid/<str:uid>",
|
"certifications/by_uid/<str:uid>",
|
||||||
views.member_certifications,
|
views.MemberCertificationListView.as_view(),
|
||||||
name="member_certifications",
|
name="member_certifications",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import get_object_or_404
|
||||||
|
from django.views.generic import ListView
|
||||||
|
|
||||||
from membershipworks.models import Member
|
from membershipworks.models import Member
|
||||||
from .models import Certification
|
from .models import Certification
|
||||||
|
|
||||||
|
|
||||||
def member_certifications(request, uid: str):
|
class MemberCertificationListView(ListView):
|
||||||
context = {
|
template_name = "paperwork/member_certifications.dj.html"
|
||||||
"member": Member.objects.get(uid=uid),
|
context_object_name = "certifications"
|
||||||
"certifications": Certification.objects.filter(member_id=uid),
|
|
||||||
}
|
def get_queryset(self):
|
||||||
return render(request, "paperwork/member_certifications.dj.html", context)
|
self.member = get_object_or_404(Member, uid=self.kwargs["uid"])
|
||||||
|
return Certification.objects.filter(member=self.member)
|
||||||
|
Loading…
Reference in New Issue
Block a user