views:

28

answers:

1

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?

+2  A: 

Try Book.__name__.

Django models are derived from the ModelBase, which is the Metaclass for all models.

The MYYN
Ah, that's is. thanks!
schneck