Re: assigning variables in templates

2008-10-20 Thread Chris Emerson
Hi, On Wed, Oct 15, 2008 at 01:46:38PM -0700, bmt wrote: > my problem is that when this list is empty i want to branch in the > template, and display some sort of message, instead of the usual 'for' > loop which would display the returned list. since i can't assign the > returned list to a

Re: assigning variables in templates

2008-10-15 Thread bmt
thanks, I forgot to mention that these are raw sql queries (because of aggregates), so the ORM cache won't help me here, but at least now I understand the reasoning behind the design more. I used a similar workaround to that what you suggested, so i read the list out in the view and passed the

Re: assigning variables in templates

2008-10-15 Thread Malcolm Tredinnick
On Wed, 2008-10-15 at 18:21 -0500, Tim Chase wrote: > > i have to check the method's return value first with an 'if' > > tag than run the query again for the 'for' loop. this doubles > > the load on the db what i don't like, not to mention that the > > two queries may return different lists. >

Re: assigning variables in templates

2008-10-15 Thread Tim Chase
> i have to check the method's return value first with an 'if' > tag than run the query again for the 'for' loop. this doubles > the load on the db what i don't like, not to mention that the > two queries may return different lists. Django's ORM should cache your query results, though it may

assigning variables in templates

2008-10-15 Thread bmt
hi, i'm trying to implement a dynamic table in django. every column of the table is coded as a python object and i want to pass a list of these objects to the template as the context. every object has a method which runs a rather expensive query on the database and returns a list which can be