see also this:
http://www.djangosnippets.org/snippets/1031/

for a tumblelog I have been actually fetching queries for each item type,
concatenating them as lists, then sorting by date.
that's much simpler since its usually mostly display.

I mostly use model inheritance in situations where I need to search shared
fields (contacts, companies, location).



On Sun, Nov 2, 2008 at 1:52 AM, void <[EMAIL PROTECTED]> wrote:

>
> Can someone point to the correct way to do this?
>
> Suppose i'm working in a tumblelog, it's basically , 4 o 5 tipes of
> "post item" that share some cmmon information.
>
> So the first approach i would go is:
>
> cllass Post(models.Model):
>   here goes common metada of all things that can be "posted" like
> taggin , dates, etc
>
> class TextPost(Post)
>  This model inherits all the metadata of the "normal" posteable
> objects and add some of it's own like
>
>  text = TexField()
>
> also we can provide a ImagePost(Post) with the same characteristics as
> textpost,
>
> The caveat folllow:
>
> Inheritance gives me a reference in the "child" model to the pk of the
> parent, that's ok.
> But i have no way of iterating to Posts elements and instantiating
> them osr seeing their attrs without knowing the correct nadme.
>
> Is any correct way to do this? will i have to hack django (or add a
> field) that backreferences the reference?
>
> The idea is traverse only the Posts objects instead o N tables (1 for
> each kinkd of post)
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to