From 84c33bd0ee35b3f486eafcf25b377246cb6e1e09 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 27 Nov 2021 15:55:38 +0700 Subject: [PATCH] add: corret page titles, allow easier setting of platformname via settings --- bread/context_processors.py | 6 ++++-- bread/views/read.py | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bread/context_processors.py b/bread/context_processors.py index 946c71fa..ca7a0dc0 100644 --- a/bread/context_processors.py +++ b/bread/context_processors.py @@ -1,4 +1,6 @@ def bread_context(request): + from django.conf import settings - ret = {} - return ret + if hasattr(settings, "PLATFORMNAME"): + return {"PLATFORMNAME": settings.PLATFORMNAME} + return {} diff --git a/bread/views/read.py b/bread/views/read.py index 1d2a5019..ff3e92c5 100644 --- a/bread/views/read.py +++ b/bread/views/read.py @@ -59,6 +59,12 @@ def get_layout(self): _layout.button.Button(_("Edit"), style="margin-top: 2rem"), ) + def get_context_data(self, *args, **kwargs): + return { + **super().get_context_data(*args, **kwargs), + "pagetitle": str(self.object), + } + def get_required_permissions(self, request): return [f"{self.model._meta.app_label}.view_{self.model.__name__.lower()}"]