Re: Resolving dynamic dictionary parameters in templates

2008-03-08 Thread Nick Fishman
Justin Fagnani wrote: > This is the third time this issue has come up in the last day :) > > Try this, since it'll work for dictionaries, lists, and objects: > > from django.template import resolve_variable > @register.filter > def lookup(value, key): > return resolve_variable(key,value) > > -Justi

Re: Resolving dynamic dictionary parameters in templates

2008-03-07 Thread Justin Fagnani
This is the third time this issue has come up in the last day :) Try this, since it'll work for dictionaries, lists, and objects: from django.template import resolve_variable @register.filter def lookup(value, key): return resolve_variable(key,value) -Justin On Fri, Mar 7, 2008 at 6:20 PM, Nick

Re: Resolving dynamic dictionary parameters in templates

2008-03-07 Thread Nick Fishman
Malcolm Tredinnick wrote: > I wouldn't be too surprised if something like that already existed at > djangosnippets.org, but, if not, it should be only a couple of lines to > write one. > Thanks, Malcom. A friend of mine found something that's exactly like what you were talking about: http://pu

Re: Resolving dynamic dictionary parameters in templates

2008-02-21 Thread Julien
I recently found that snippet, which you could use to assign a temporary variable in your template: http://www.djangosnippets.org/snippets/539/ In theory, it's bad practice, but so useful in some situation ;) On Feb 22, 1:13 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-02-21

Re: Resolving dynamic dictionary parameters in templates

2008-02-21 Thread Malcolm Tredinnick
On Thu, 2008-02-21 at 20:47 -0500, Nick Fishman wrote: > Hey everyone. I've run into an issue with dictionaries in templates, and > I'm kind of stuck. I'm trying to track incidents by username and month. > Here's what I have passed into a template: > > months = ['Mar', 'Feb', 'Aug', 'Sep', 'Apr'

Resolving dynamic dictionary parameters in templates

2008-02-21 Thread Nick Fishman
Hey everyone. I've run into an issue with dictionaries in templates, and I'm kind of stuck. I'm trying to track incidents by username and month. Here's what I have passed into a template: months = ['Mar', 'Feb', 'Aug', 'Sep', 'Apr', 'Jan', 'May', 'Nov', 'Dec', 'Oct'] mapping = {'username': u'jdoe