Re: how to create json from template?

2008-12-03 Thread Viktor
thanks V On dec. 3, 07:49, "David Zhou" <[EMAIL PROTECTED]> wrote: > On Wed, Dec 3, 2008 at 1:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > To trim last colon wrap it with if statement: > > > {% if forloop.revcounter0 %},{% endif %} > > You can also do: > > {% if not forloop.last %},{% e

Re: how to create json from template?

2008-12-02 Thread Alex Koshelev
Oh, Yes. Good point. On Wed, Dec 3, 2008 at 09:49, David Zhou <[EMAIL PROTECTED]> wrote: > > On Wed, Dec 3, 2008 at 1:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > > To trim last colon wrap it with if statement: > > > > {% if forloop.revcounter0 %},{% endif %} > > You can also do: > > {%

Re: how to create json from template?

2008-12-02 Thread David Zhou
On Wed, Dec 3, 2008 at 1:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > To trim last colon wrap it with if statement: > > {% if forloop.revcounter0 %},{% endif %} You can also do: {% if not forloop.last %},{% endif %} Which, IMO, is slightly more clear. --- David Zhou [EMAIL PROTECTED]

Re: how to create json from template?

2008-12-02 Thread Alex Koshelev
To trim last colon wrap it with if statement: {% if forloop.revcounter0 %},{% endif %} On Wed, Dec 3, 2008 at 04:26, Viktor Nagy <[EMAIL PROTECTED]> wrote: > Hi, > > I know about the serialisation framework, but with MultiResponse[1] you > can't really use it (and anyway I don't know how to cust

how to create json from template?

2008-12-02 Thread Viktor Nagy
Hi, I know about the serialisation framework, but with MultiResponse[1] you can't really use it (and anyway I don't know how to customise it extensively). As a result I would like to create json with the django template engine. An example code would be this: [{% for poll in data %} {"question":