1👍
Using type(object)
method you get a reference to the object type class. See documentation.
That type
class has an __name__
attribute, which stores the class name.
Also, django models provide us two _meta
attributes for the same proposal: verbose_name
and verbose_name_plural
. See documentation.
So, you can use any of them:
print type(model).__name__
print type(model)._meta.verbose_name
print type(model)._meta.verbose_name_plural
Source:stackexchange.com