Tweak default "model title" logic for master view

i.e. if view class doesn't declare one
This commit is contained in:
Lance Edgar 2018-11-22 11:12:31 -06:00
parent 4ad958b9d2
commit 0375d66b91

View file

@ -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):