How to get Model from object?

13 views
Skip to first unread message

Davide.D

unread,
Mar 3, 2008, 10:09:02 PM3/3/08
to Django users
class MyModel(models.Model):
...
...

How to get MyModel from mymodel_obj?

Thanks!

Hugh Bien

unread,
Mar 3, 2008, 10:45:46 PM3/3/08
to django...@googlegroups.com
In Python, you can always get a class from an object using the built-in 'type' method:

type(mymodel_obj)

bob ning

unread,
Mar 4, 2008, 12:30:16 AM3/4/08
to django...@googlegroups.com
mymodel_obj.__class__
--
python&django
Reply all
Reply to author
Forward
0 new messages