I've got an instance of a model FooBar
- how do I get the naturalised type Foo Bar
for display to the user, making sure to 开发者_运维百科use the class's verbose_name
if one is set in the Meta
options. e.g.:
class FooBar(models.Model):
title = models.CharField(max_length = 100)
class Meta:
verbose_name = 'Spaghetti Monster'
How do I get 'Spaghetti Monster' from an instance of a FooBar
?
foobar._meta.verbose_name
精彩评论