Re: Template help, gotta be simple

2008-02-03 Thread rex
it *should* be in the view anyway??? it's logic... but it should be possible? Something like this would work... although.. it's hideously innefficient. {% for row in data %} {% for key,val in row.items %} {% for field in fields %} {% ifequal field key %} {{ key }}: {{ val }} {% endifequal %} {% e

Re: Template help, gotta be simple

2008-02-02 Thread Ned Batchelder
I'm not sure there's a way to do this purely in the template language. You can munge the data in the view instead. This line creates a new filtered_data list that has only the data you want to display: filtered_data = [ dict([ (k,d[k]) for k in fields ]) for d in data ] --Ned. http://nedbatc

Template help, gotta be simple

2008-02-02 Thread Michael Hipp
I'm trying to do something with a template that I thought would be very simple but I've not yet found a way to make it work at all. from django.template import Template, Context fields = ("f1", "f3") data = [ {"f1": "Foo", "f2": "Skip ","f3": "Bar"}, {"f1": "Cat", "f2": "Ignore","f3":