Thanks, both of you :o)

I tried using it directly in my template like
{{object.__class__.__name__}}
But that didnt work.

So I did it by adding this to my models:

        def get_model_name(self):
                return self.__class__.__name__


And it works....

Thanks again :o)

On 27 Aug., 13:29, David Zhou <[email protected]> wrote:
> On Thu, Aug 27, 2009 at 7:08 AM, Léon Dignòn<[email protected]> wrote:
>
> >>>> from django.contrib.auth.models import User
> >>>> u = User.objects.get(id=1)
> >>>> u
> > <User: leon>
> >>>> print u
> > leon
> >>>> type(u)
> > <class 'django.contrib.auth.models.User'>
>
> Alternatively:
>
> >>> u.__class__.__name__
>
> 'User'
>
> -- dz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to