Bah! As usual...I figure this out right after posting something. This works:
{% for object in stream_list %} {% ifequal object._meta.object_name 'Entry' %} On Apr 16, 4:33 pm, BradMcGonigle <bradford.mcgoni...@gmail.com> wrote: > Oddly enough I am trying to do the exact same thing Matt is trying to > do. > > I tried this: > > {% for object in stream_list %} > {% if object._meta.Entry %} > > but underscores are not allowed to start variables and attributes. > > Is there another way to do this at the template level or is my syntax > just wrong. > > Brad > > On Apr 16, 2:00 pm, Daniel Roseman <roseman.dan...@googlemail.com> > wrote: > > > On Apr 16, 6:02 pm, Matthew <matthew.vix...@gmail.com> wrote: > > > > Is it possible to do this? > > > > I'm using a custom MultiQuerySet snippet to merge a bunch of querysets > > > from different models, and then I want to iterate over the resultant > > >list, but I want to be able to pull out from eachobjectin thelist > > > its ownModeltype so I can perform a few comparisons/functions. Short > > > of writing a method into eachmodel, I can't think of anyway it could > > > be done, and that won't work because I want to throw Comments into > > > that merged queryset too. > > > > Help would be much appreciated, > > > Thanks > > > Matt > > > There's a couple of ways. > > > You could use the built-in Python attribute __class__ that exists on > > everyobject. This returns a classobject. > > > Or, you could use some of the data in the _meta subclass of each > > Djangomodel. For instance, x._meta.object_name gives the name of > > x'smodeltype. Do dir(x._meta) to get alist. > > -- > > DR. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---