On 3/31/06, Andy Dustman <[EMAIL PROTECTED]> wrote:
>
> At present (in magic-removal), If I make a BaseRecord type with all
> the common attributes and then make other records subclass it (not
> exactly what you are asking for with mixins), I can create new entries
> fine, but I can't access them through the admin interface because it
> tries to pull them out of the wrong table (the superclass table).
>
> I also tried having the common elements as a mixin, but that didn't
> work right either. (I may have to revisit this, though.)

Neither mixins nor subclassing really work at this point. At all. Some
of the plumbing has been done (adding fields of all the parents to a
subclass), but any type of select will not work. If it does, I'd have
to call it crazy coincidence.

> I have some notes on the ModelInheritance page about possibly using
> views to simplify reading, and while none of the databases I could
> find could do a multi-table update through a view without writing
> stored procecures and triggers, I realized that individually updating
> the underlying tables is no worse than if you didn't use views. So
> views seem to be a win for reading and neutral for writing.

I thought the same thing, but I was both pessimistic and lazy. I
didn't beleive that the 3 main players (postgres, mysql, sqlite) would
all let you update and insert on views, and I didn't reasearch it to
make sure :)

I'm not convinced that the wiki discusses the best method for Django.
Martin Fowler discusses 3 main inheritence patterns in PEA, and that
said, rails ActiveRecord, SQLObject, and SQLAlchemy all pick a
different one. (AFAICT anyhow, someone correct me if they know
differently. SQLAlchemy probably has the potential to do all 3, but
it's certainly not any kind of "out of the box" or documented type
thing.)

IMHO, supporting all 3 models is out of the question for Django. If
someone really needs an ORM that flexible, they shouldn't be using
Django's ORM. Each method has tradeoffs, so I'll try to summarize them
all in the next week or so.

Joseph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to