Re: Simple Template Dict Problem

2007-06-18 Thread Tim TerlegÄrd
On Mon, Jun 18, 2007 at 03:44:03PM +0200, Aidas Bendoraitis wrote: > > Hello Trey! > > You can iterate by the entries of a dictionary, using this: > > {% for i in d.items %} > {{ i.0 }}: {{ i.1 }} > {% endfor %} > > Regards, > Aidas Bendoraitis aka Archatas > > > > On 6/7/07, Trey <[EMAIL

Re: Simple Template Dict Problem

2007-06-18 Thread Aidas Bendoraitis
Hello Trey! You can iterate by the entries of a dictionary, using this: {% for i in d.items %} {{ i.0 }}: {{ i.1 }} {% endfor %} Regards, Aidas Bendoraitis aka Archatas On 6/7/07, Trey <[EMAIL PROTECTED]> wrote: > > Thanks Russ, I think my answer for today is three dimensional lists... > Ho

Re: Simple Template Dict Problem

2007-06-07 Thread Trey
Thanks Russ, I think my answer for today is three dimensional lists... Hooray for complex datastructures :) Tim, that's a very cool idea. I will research this some and see if I can abstract the calendar control. On Jun 7, 11:02 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > Somehow I doubt this sh

Re: Simple Template Dict Problem

2007-06-07 Thread Tim Chase
> Somehow I doubt this should really be in the view either. Maybe it's > just one of those out liers that doesn't have a good place. Sounds like you're describing template tags. They're ways of creating reusable bits you can just drop into your templates to abstract away the logic required to

Re: Simple Template Dict Problem

2007-06-07 Thread Russell Keith-Magee
On 6/7/07, Trey <[EMAIL PROTECTED]> wrote: > > I thought that something like that was the answer. > > Normally I would agree but I can't think of another way to make a > calendar style layout with certain events on it. Check out my glorious > hack and tell me what you think. My eyes! They burn! :

Re: Simple Template Dict Problem

2007-06-07 Thread Trey
I thought that something like that was the answer. Normally I would agree but I can't think of another way to make a calendar style layout with certain events on it. Check out my glorious hack and tell me what you think. c is a matrix from the calendar object. import calendar calendar.

Re: Simple Template Dict Problem

2007-06-07 Thread Russell Keith-Magee
On 6/7/07, Trey <[EMAIL PROTECTED]> wrote: > > The first line, dict.1 works fine. But when I try to use the d > variable for the dict index it doesn't work. Is there a way to > accomplish this? No, by design. We have explicitly tried to avoid making the django template language a programming lang

Re: Simple Template Dict Problem

2007-06-07 Thread Trey
That wasn't exactly the example as it was written. Let me try to clarify. w is simply a list of numbers. w = [1,2,3,4,5,6,7,] Take this dict. dict = {1: 10, 2: 10, 19: 0, 29: 0, 30: 10} {% for x in w %} {{dict.1}} {{dict.x}} {% endfor %} --~--~-~--~~~---~--

Re: Simple Template Dict Problem

2007-06-06 Thread [EMAIL PROTECTED]
w : {1: 10, 2: 10, 19: 0, 29: 0, 30: 10} {% for d in w %} {{d.1}} {{d.2}} {% endfor %} d ISN'T an interation of a loop incrementing. It's interating THROUGH w. So d is one element of w each iteration list : {'a','b','c','d'} {% for item in list %} {{item}} {% endfor %} a b c d If your com

Simple Template Dict Problem

2007-06-06 Thread Trey
I have a simple problem that I am not quite sure why it won't work. Take this dict. {1: 10, 2: 10, 19: 0, 29: 0, 30: 10} w is simply a list of numbers {% for d in w %} {{dict.1}} {{dict.d}} {% endfor %} The first line, dict.1 works fine. But when I try to use the d variable for the dict in