#3371: Filter to get dict's value by key name (for the purpose of enabling
variable lookups in the template)
-------------------------------------+-------------------------------------
     Reporter:  Alex Dedul           |                    Owner:  nobody
         Type:  New feature          |                   Status:  closed
    Component:  Template system      |                  Version:  master
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:  template filter      |             Triage Stage:
  dict key                           |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by djdev7):

 There are 3 questions on SO that talk about this with a combined view
 count of 40,000+.
 http://stackoverflow.com/q/8000022/781695
 http://stackoverflow.com/q/2894365/781695
 http://stackoverflow.com/q/2067006/781695

 I agree with the reasoning about why the discussion should be moved to
 mailing list. This ticket ranks high up in google search for this issue
 and it'll be a '''big''' help for many newbies to simply find a workaround
 without opening security holes etc.. My '''polite''' request to core
 developers is to simply comment on usability/security of this solution.
 Most of us are pretty happy with Django templating language and wouldn't
 want to switch to Jinja2. However, often there are instances where a
 variable lookup is needed as witnessed by the activity on Stackoverflow.

 http://stackoverflow.com/a/8000091/781695

 {{{

 @register.filter
 def get_item(dictionary, key):
     return dictionary.get(key)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/3371#comment:18>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.183335b44c52c9c517cb4d416f3c787e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to