Tweak default "model title" logic for master view
i.e. if view class doesn't declare one
This commit is contained in:
parent
4ad958b9d2
commit
0375d66b91
|
@ -1780,7 +1780,14 @@ class MasterView(View):
|
||||||
"""
|
"""
|
||||||
if hasattr(cls, 'model_title'):
|
if hasattr(cls, 'model_title'):
|
||||||
return 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
|
@classmethod
|
||||||
def get_model_title_plural(cls):
|
def get_model_title_plural(cls):
|
||||||
|
|
Loading…
Reference in a new issue