On 3/9/06, Rob Slotboom <[EMAIL PROTECTED]> wrote:
> Is there a way to get an object's content_type_id?
>
> I need it to store an object's id and content_type_id in another table.
>
> Currently I solved this by using an sql-statement but maybe there is
> some 'hidden' property or function like:
> self.content_type or self.get_content_type

The cleanest way to do this would be:

    from django.models.core import contenttypes
    ct = contenttypes.get_object(package__package__exact='news', \
        python_module_name__exact='reporters')

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to