Hi there,
I have a django model:
class Book(models.Model):
[..]
and I want to have the model name as string: 'Book'. When I try to get it this way:
Book.__class__.__name__
it returns 'ModelBase'.
Any idea?
Hi there,
I have a django model:
class Book(models.Model):
[..]
and I want to have the model name as string: 'Book'. When I try to get it this way:
Book.__class__.__name__
it returns 'ModelBase'.
Any idea?
Try Book.__name__
.
Django models are derived from the ModelBase
, which is the Metaclass for all models.