From f42101c47623aae620bb9bdb7c641248cc4e00c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Mon, 2 Oct 2023 20:50:39 +0200 Subject: [PATCH] Adding some titles --- .gitignore | 2 ++ .../templates/membership/members_admin_detail.html | 4 ++++ .../templates/membership/membership_overview.html | 4 ++++ src/membership/views.py | 2 ++ src/project/templates/index.html | 4 ++++ src/project/views.py | 2 +- src/utils/templates/utils/list.html | 6 +++++- src/utils/view_utils.py | 4 ++++ 8 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index cb12fcd..c4bb9c0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ db.sqlite3 .pytest_cache .idea/ *.mo +.env +venv/ diff --git a/src/membership/templates/membership/members_admin_detail.html b/src/membership/templates/membership/members_admin_detail.html index 87a6235..c3e02b7 100644 --- a/src/membership/templates/membership/members_admin_detail.html +++ b/src/membership/templates/membership/members_admin_detail.html @@ -1,6 +1,10 @@ {% extends "base.html" %} {% load i18n %} +{% block head_title %} + {% trans "Member detail" %} +{% endblock %} + {% block content %}

diff --git a/src/membership/templates/membership/membership_overview.html b/src/membership/templates/membership/membership_overview.html index b26f4b2..3e12bb7 100644 --- a/src/membership/templates/membership/membership_overview.html +++ b/src/membership/templates/membership/membership_overview.html @@ -1,6 +1,10 @@ {% extends "base.html" %} {% load i18n %} +{% block head_title %} + {% trans "Membership" %} +{% endblock %} + {% block content %} {% if not current_membership %} diff --git a/src/membership/views.py b/src/membership/views.py index e20f43f..17005eb 100644 --- a/src/membership/views.py +++ b/src/membership/views.py @@ -39,6 +39,8 @@ def members_admin(request): users = get_members() return render_list( + entity_name="member", + entity_name_plural="members", request=request, paginate_by=20, objects=users, diff --git a/src/project/templates/index.html b/src/project/templates/index.html index 94d9808..affce2e 100644 --- a/src/project/templates/index.html +++ b/src/project/templates/index.html @@ -1 +1,5 @@ {% extends "base.html" %} + +{% block head_title %} + {% trans "Home" %} +{% endblock %} diff --git a/src/project/views.py b/src/project/views.py index 38d2a74..26db680 100644 --- a/src/project/views.py +++ b/src/project/views.py @@ -1,4 +1,4 @@ -from django.shortcuts import render +from utils.view_utils import render def index(request): diff --git a/src/utils/templates/utils/list.html b/src/utils/templates/utils/list.html index 277e398..e67ff3e 100644 --- a/src/utils/templates/utils/list.html +++ b/src/utils/templates/utils/list.html @@ -1,10 +1,14 @@ {% extends "base.html" %} {% load i18n %} +{% block head_title %} + {{ entity_name_plural|capfirst }} +{% endblock %} + {% block content %}

- Users {{ total_count }} + {{ entity_name_plural|capfirst }} {{ total_count }}

diff --git a/src/utils/view_utils.py b/src/utils/view_utils.py index 535086b..7b2e416 100644 --- a/src/utils/view_utils.py +++ b/src/utils/view_utils.py @@ -46,6 +46,8 @@ class RowAction: def render_list( request: HttpRequest, + entity_name: str, + entity_name_plural: str, objects: list["Model"], columns: list[tuple[str, str]], row_actions: list[RowAction] = None, @@ -87,6 +89,8 @@ def render_list( "list_actions": list_actions, "total_count": total_count, "order_by": order_by, + "entity_name": entity_name, + "entity_name_plural": entity_name_plural, } if paginate_by: