Hi Alex,

> I have a news application that I would like some help with.
>
> My view generates a list with objects mixed with dictionaries with two
> objects. Then in my template, I want to loop through this list and
> output each value. However, when it encounters a dictionary in the
> list I want it to loop through it separately with a different
> formatting.
>
> This is an example of a dict passed to my template:
>
> http://dpaste.com/91439/
>
> So the question is: how do I check (in the template) if the object
> that is being run in the for loop is a dictionary, so that I in turn
> can run a for loop on it? Or is there a better way of doing this other
> than mixing objects and dictionaries in the list?

You could create a relatively simple custom template tag that knows
how to render an element from your list. The templatetag is Python
code, so you would be able to test for the type of the element being
rendered.

-RD

--~--~---------~--~----~------------~-------~--~----~
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