Mike, Thanks for the replay. I realize I was probably too general in my request. Allow me to get down and dirty.
So I did some more research and tried this approach in my model: class NewsManager(models.Manager): def all_news(self): qs = Event.objects.extra(tables=['news_article', 'news_release']) # qs = Event.object.all() return qs class News(models.Model): objects = NewsManager() class Article(models.Model): headline = models.CharField('headline', maxlength=200) slug = models.SlugField('URL suffix', prepopulate_from=('headline',)) date = models.DateField() link = models.URLField('link to article', help_text='Enter a web link (URL) to the event here.', blank=True) publication = models.CharField('publication', maxlength=100, blank=True) class Event(models.Model): headline = models.CharField('headline', maxlength=200) slug = models.SlugField('URL suffix', prepopulate_from=('headline',)) date = models.DateField() link = models.URLField('link to event site', help_text='Enter a web link (URL) to the event here.', blank=True) venue = models.CharField('venue', maxlength=100, blank=True) class Release(models.Model): headline = models.CharField('headline', maxlength=200) slug = models.SlugField('URL suffix', prepopulate_from=('headline',)) date = models.DateField() I have a feeling I'm misusing or not understanding the "extra" option. I'm wondering if I could use raw sql, but I'm unsure how to do that and make the result look like a queryset. Perhaps this is not possible because the tables are different? If I instead use the commented-out line in the custom manager and choose an event to drill down on, it does work. This is where my understanding begins to wane. My other approach has been to create a view where I examine each applicable model in the app individually, one at a time until I find the slug. Thoughts? Enlightenment? -raymond On Apr 14, 1:48 pm, "Mike Axiak" <[EMAIL PROTECTED]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---