Re: Dictionaries, templates and best practices

2008-06-17 Thread David Zhou
Couldn't you do: test = [] test.append({'title': 'My First Title', 'post': 'My First Post'}); test.append({'title': 'My Second Title', 'post': 'My Second Post'}); ? On Jun 18, 2008, at 4:11 PM, Juan Hernandez wrote: > it does not return any values. > > I did post.0.title because the

Re: Dictionaries, templates and best practices

2008-06-17 Thread Joel Bernstein
Oops, I totally missed that 'test' was a dictionary. This should work then: {% for key, x in posts.items %} {{ x.title }} {{ x.post }} {% endfor %} Alternately, if your keys are just going to be sequential integers, you could just put this stuff into a list and use my first suggestion. On

Re: Dictionaries, templates and best practices

2008-06-17 Thread Norman Harman
Juan Hernandez wrote: > it does not return any values. > > I did post.0.title because the dictionary is established like this: > > >>> test > {0: {'post': 'My First Post', 'title': 'My First Title'}, 1: {'post': > 'My Second Post', 'title': 'My Second Title'}} > > and it goes on and on > >

Re: Dictionaries, templates and best practices

2008-06-17 Thread Juan Hernandez
it does not return any values. I did post.0.title because the dictionary is established like this: >>> test {0: {'post': 'My First Post', 'title': 'My First Title'}, 1: {'post': 'My Second Post', 'title': 'My Second Title'}} and it goes on and on If I could iterate over it, like post.0.title,

Re: Dictionaries, templates and best practices

2008-06-17 Thread Joel Bernstein
I could be completely mistaken, but can't you replace 'post.0.title' and 'post.0.post' with 'x.title' and 'x.post', respectively? On Jun 17, 1:50 pm, "Juan Hernandez" <[EMAIL PROTECTED]> wrote: > Hey there > > I've been practicing for a while with the template system and I have some > questions: