Hallöchen!

Tom Evans writes:

> On Wed, Apr 21, 2010 at 5:38 PM, Torsten Bronger
> <bron...@physik.rwth-aachen.de> wrote:
>
>> I think Django should store the fully qualified class name of
>> each row in the parent table.  For example, the "Person" table
>> would have a column with entries like "myapp.Author" or
>> "myapp.Translator".  Then, a find_actual_instance method could be
>> implemented both reliably and efficiently.
>
> This is effectively what contenttypes and generic foreign keys
> do. A GFK has two parts, an item id, and a foreign key to the
> content type model, which is a register of all django models,
> allowing you to easily construct a Derived from a Base
> reference. See the end of my reply to Tim and the docs:
>
> http://docs.djangoproject.com/en/1.1/ref/contrib/contenttypes/#id1

Right, and I said that contenttypes are the way to go in my first
posting.

But I think that it's not too expensive if by default Django stored
both the PK and the actual model name in the parent table.
Additionally, find_actual_instance should be built-in based on this
additional column.

After all, I've read about this problem for the forth time on this
list (and I don't read it regularly), plus a private email
conversion with someone who found old postings of me on Google
Groups.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
                                  or http://bronger-jmp.appspot.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to