From ed49d45abde453d18f886991b4e94642ab688e49 Mon Sep 17 00:00:00 2001 From: Lacey Williams Henschel Date: Wed, 4 Jan 2023 11:30:30 -0800 Subject: [PATCH 1/2] #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 %}
From 83d25d89fc61c587086615795d62c6b8e491897f Mon Sep 17 00:00:00 2001 From: Lacey Williams Henschel Date: Wed, 4 Jan 2023 11:37:43 -0800 Subject: [PATCH 2/2] :shirt: Linter --- libraries/views.py | 4 +++- templates/libraries/list.html | 12 +++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/views.py b/libraries/views.py index 3a0a62ef..4be02f30 100644 --- a/libraries/views.py +++ b/libraries/views.py @@ -14,7 +14,9 @@ class LibraryList(CategoryMixin, ListView): """List all of our libraries by name""" paginate_by = 25 - queryset = Library.objects.prefetch_related("authors", "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/list.html b/templates/libraries/list.html index 3e9ced8b..3d3fd3a8 100644 --- a/templates/libraries/list.html +++ b/templates/libraries/list.html @@ -73,13 +73,11 @@
Author(s):
- {% if library.authors.count %} -
- {% for author in library.authors.all %} -
user {{ author.get_full_name }}
- {% endfor %} -
- {% endif %} +
+ {% for author in library.authors.all %} +
user {{ author.get_full_name }}
+ {% endfor %} +