Re: defaultdict is not working on "for" template tag iteration.

2008-11-07 Thread Hyungyong Kim
Thanks for kind expatiation. I can understand why the error occured easily. But, it seems that templates' "." has to resolve dir(default_dict) first before dictionary lookup. Anyway, I glad to know the reason. Thanks. Hyungyong Kim On 11월7일, 오후10시18분, "Karen Tracey" <[EMAIL PROTECTED]> wrote:

Re: defaultdict is not working on "for" template tag iteration.

2008-11-07 Thread Karen Tracey
On Fri, Nov 7, 2008 at 2:51 AM, Hyungyong Kim <[EMAIL PROTECTED]> wrote: > > Hi, > > Since a few hours ago, I've suffered following problem. > I found this problem is due to collections.defaultdict. > > Normal dictionary is working collectly, but defaultdict is not > working. > > >>> from django.t

Re: defaultdict is not working on "for" template tag iteration.

2008-11-07 Thread Raja
Well, it does, except that when you do a default_dict.items, it adds "items" to the dict with a value of 0 in the template. To verify this, try dumping default_dict after the exception is thrown. You will get a new key called "items". To fix your problem, pass dict(default_dict) to the Context. >

defaultdict is not working on "for" template tag iteration.

2008-11-06 Thread Hyungyong Kim
Hi, Since a few hours ago, I've suffered following problem. I found this problem is due to collections.defaultdict. Normal dictionary is working collectly, but defaultdict is not working. >>> from django.template import Template, Context >>> t = Template("{% for k,v in data.items %}{{ k }}: {{