I'm sure this subject has been beaten to death, but I haven't found an
answer to a simple scenario and I'm wondering why this hasn't been
addressed before.

I have three models, structured like so:

Document
-Presentation
-Spreadsheet

Document is never instantiated on its own; a prime candidate for an
abstract base class. However, there are times where I want to list/
search across all documents, and I'd like to be able to write
Document.objects.all(). I'd then like to be able to iterate over this
enumerable and have each object cast to its proper class.

This is something accomplished with single table inheritance in Rails;
why don't we have the equivalent in Django?

I know I could just use the Document class and have a type field, but
then I have to do all of the type checking legwork manually. I was
hoping Django would handle normalizing/denormalizing as part of the
ORM. In essence, creating its own type field automatically in the back-
end and casting each object to the appropriate class based on the
string value in this field.

Does anyone know why this isn't available? Is there an equally
efficient method of modeling this approach of which I am unaware?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to