Hey Raymond,

A couple ideas that wouldn't require a different type of generic view:

1)
If they are related to each other, why not use the relations to get
the objects you want?

{% for event in article.event_set.all %}...

2)
If all your pages are using the events etc. Why not create a context
processor to get the information you need?


Note that it may be the case that neither of these appropriately match
your problem. In that case, why not write your own 4-line view? You
can even use
function wrappers (in python > 2.3, decorator syntax) to maintain DRY.

Hope this helps.

Cheers,
Mike Axiak

On Apr 13, 11:59 pm, "watusee" <[EMAIL PROTECTED]> wrote:
> Greetings all. I have a problem/concept I've been struggling with. I
> have an app called News with three models: Article, Press Release and
> Event. Each model has some fields in common (headline, date, body) and
> other fields unique to each model. I had initially thought to combine
> the three models into one mega-model, but didn't like the way it
> worked in the admin tool. I felt it would be too confusing to have
> optional fields for each type.
>
> The problem with three models is that in practice I'm using them all
> together, typically sorted by date. I want to use generic views to
> show the list of news items as well as the detail view. Unfortunately
> I cannot think of a way to combine the data from the three models in a
> way to use them with a generic wrapper because I believe a generic
> view requires a queryset and a queryset cannot be comprised of
> different (but similar) models.
>
> I'm assuming others before me have run into this issue and figured out
> an elegant solution. Let me also say I'm a bit of a beginner in the
> framework and working on my first project, so it's not unlikely that
> I'm completely missing something.
>
> Thank you!
>
> -raymond


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to