From ed49d45abde453d18f886991b4e94642ab688e49 Mon Sep 17 00:00:00 2001 From: Lacey Williams Henschel Date: Wed, 4 Jan 2023 11:30:30 -0800 Subject: [PATCH] #67 Show author and maintainer name on library pages --- libraries/views.py | 2 +- templates/libraries/detail.html | 10 ++++++---- templates/libraries/list.html | 12 +++++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libraries/views.py b/libraries/views.py index 330eed67..3a0a62ef 100644 --- a/libraries/views.py +++ b/libraries/views.py @@ -14,7 +14,7 @@ class LibraryList(CategoryMixin, ListView): """List all of our libraries by name""" paginate_by = 25 - queryset = Library.objects.prefetch_related("categories").all().order_by("name") + queryset = Library.objects.prefetch_related("authors", "categories").all().order_by("name") template_name = "libraries/list.html" diff --git a/templates/libraries/detail.html b/templates/libraries/detail.html index a586eaa7..e97633ae 100644 --- a/templates/libraries/detail.html +++ b/templates/libraries/detail.html @@ -81,15 +81,17 @@

Authors

-
user Glen Fernandes
-
user Glen Fernandes
+ {% for author in object.authors.all %} +
user {{ author.get_full_name }}
+ {% endfor %}

Maintainers

-
user Glen Fernandes
-
user Glen Fernandes
+ {% for maintainer in object.maintainers.all %} +
user {{ maintainer.get_full_name }}
+ {% endfor %}
diff --git a/templates/libraries/list.html b/templates/libraries/list.html index f3e06f4f..3e9ced8b 100644 --- a/templates/libraries/list.html +++ b/templates/libraries/list.html @@ -73,11 +73,13 @@
Author(s):
-
-
user Glen Fernandes
-
user Glen Fernandes
-
user Glen Fernandes
-
+ {% if library.authors.count %} +
+ {% for author in library.authors.all %} +
user {{ author.get_full_name }}
+ {% endfor %} +
+ {% endif %}