Get class name of django model
Try Book.__name__
.
Django models are derived from the ModelBase
, which is the Metaclass for all models.
Instead of doing Book.__class__.__name__
on class itself, if you do it over a book object, then book_object.__class__.__name__
will give you 'Book' (i.e the name of the model)