Re: How to do dynamic lookup of variables.

2007-02-15 Thread Benedict Verheyen
Michael Lake schreef: > Yes it does work, thanks heaps. I presume though that the render_to_return is > outside > of the previous for loop as below. Yes it's outside the loop as you already found out. > for e in experiment_list: > e.proc_count = e.experiment_procedure_set.all().count()

Re: How to do dynamic lookup of variables.

2007-02-15 Thread jfagnani
On Feb 14, 4:41 pm, Mike Lake <[EMAIL PROTECTED]> wrote: > There are references to 'dynamic lookup' of variables in the docs for > template authors. > But this seems very complex to use custom tags and filters. A custom lookup filter is quite easy to do, because the template module already has

Re: How to do dynamic lookup of variables.

2007-02-15 Thread Michael Lake
Hi Benedict Verheyen wrote: > When i need such functionality, i assign values to vars of the list items. > For instance, in your case i would do something like this > def experiments(request): > experiment_list = Experiment.objects.all() > ecount = len(experiment_list) + 1 > >

Re: How to do dynamic lookup of variables.

2007-02-14 Thread Benedict Verheyen
Mike Lake schreef: > Hi all > > Im trying to place into a list of experiments the number of procedures for > each experiment. > From within the views.py I can save the number of procedures in an experiment > into either a list of tuples (e.id, count) or a dictionary {'e.id': count}. > But

How to do dynamic lookup of variables.

2007-02-14 Thread Mike Lake
Hi all Im trying to place into a list of experiments the number of procedures for each experiment. >From within the views.py I can save the number of procedures in an experiment >into either a list of tuples (e.id, count) or a dictionary {'e.id': count}. >But when I come to access them in the