On Sat, 2009-02-07 at 12:40 -0800, seanbrant wrote:
> Im have troubling figuring about a good solution for blog posts. I
> have created a ABC called Entry which Post, Link, Photo, Quote
> inherit.

It would help others to define a few terms here before leaping into the
acronyms: ABC = "abstract base class", MTI = "multi-table inheritance",
I'm guessing.

> 
> I first tired it with MTI and set Entry.objects.all() as the queryset
> attribute. This will pass the list of Entry's to the template which I
> can iterate over. However I would like to style each type of Entry
> object a little different. Is there a way to know which type of Entry
> you are dealing with.

Yes, by adding a field called "child_type" or something similar and
noting the content type of the most derived child, for example.

> Then I tried ABC with the same models. Obviously including abstract
> True to the Base Entry class. With this approach I have know idea  how
> to get a query set for all of these objects.

You can't. They different types aren't related to each other. You need
to make "N" querysets and write your own version of the generic view
(remember, generic views are just an aid -- they don't fit all
requirements and not using them is always an option).

> This seems like a fairly common use-case,

Which is why it's been answered a number of times in the past. :-)

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