On Sat, 2009-03-07 at 06:50 -0600, Tim Chase wrote:
[...]
> A slightly less DRY solution than ideal (ideal=solving the VERY 
> complex STI problem in Django's ORM),

Um .. no. That's the one thing that is almost certainly not going to
happen. Single-table inheritance --- a.k.a shoving all your columns for
all your models into a single table -- is a really bad design pattern
(you lose the ability to do all sorts of things, like enforcing not-NUL
constraints). Not to mention being completely impractical when it comes
to subclassing third-party models.

If you want to do this, there's a much better way: you create one table
(either manually or by creating a mega-model and running syncdb). Then
you create your submodels which only specify the columns they are
interested in. After all, a Django model doesn't have to specify or
utilise every single column in a database table.

So if you want to use this pattern, treat it honestly: it's a single
table where you're only accessing a subset of columns. Django can
already support that.

The "complex" thing that we might do, one day, is providing a way to
also retrieve all the descendents from a base table. It won't be
particularly efficient, but that's because SQL is relational and not
object-oriented.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 
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