Don't assume grid model class declares its title
that works for Rattail models, but not e.g. those from Onager
This commit is contained in:
parent
5c86ab38a4
commit
0d00bd746e
|
@ -87,12 +87,12 @@ class Grid(object):
|
||||||
self.columns = self.make_columns()
|
self.columns = self.make_columns()
|
||||||
|
|
||||||
self.model_title = model_title
|
self.model_title = model_title
|
||||||
if not self.model_title and self.model_class:
|
if not self.model_title and self.model_class and hasattr(self.model_class, 'get_model_title'):
|
||||||
self.model_title = self.model_class.get_model_title()
|
self.model_title = self.model_class.get_model_title()
|
||||||
|
|
||||||
self.model_title_plural = model_title_plural
|
self.model_title_plural = model_title_plural
|
||||||
if not self.model_title_plural:
|
if not self.model_title_plural:
|
||||||
if self.model_class:
|
if self.model_class and hasattr(self.model_class, 'get_model_title_plural'):
|
||||||
self.model_title_plural = self.model_class.get_model_title_plural()
|
self.model_title_plural = self.model_class.get_model_title_plural()
|
||||||
if not self.model_title_plural:
|
if not self.model_title_plural:
|
||||||
self.model_title_plural = '{}s'.format(self.model_title)
|
self.model_title_plural = '{}s'.format(self.model_title)
|
||||||
|
|
Loading…
Reference in a new issue