From 0375d66b9112f4a169c7c0df567300cbeeeb49bb Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 22 Nov 2018 11:12:31 -0600 Subject: [PATCH] Tweak default "model title" logic for master view i.e. if view class doesn't declare one --- tailbone/views/master.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tailbone/views/master.py b/tailbone/views/master.py index e4c267b3..2283faee 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -1780,7 +1780,14 @@ class MasterView(View): """ if hasattr(cls, 'model_title'): return cls.model_title - return cls.get_model_class().get_model_title() + + # model class itself may provide title + model_class = cls.get_model_class() + if hasattr(model_class, 'get_model_title'): + return model_class.get_model_title() + + # otherwise just use model class name + return model_class.__name__ @classmethod def get_model_title_plural(cls):