> > This has been discussed ad nauseam in the past, and has been rejected > repeatedly. >
Sorry, new to the group - is there an easy way to search old threads? Google keeps pointing me to the docs... - Andrey On Tue, Aug 11, 2009 at 11:20 AM, Andrew Gwozdziewycz <[email protected]>wrote: > > On Tue, Aug 11, 2009 at 10:50 AM, Richard > Davies<[email protected]> wrote: > > > > Hi all, > > > > With 1.1 out of the door (great!), here's a thought for 1.2... > > > > I often end up writing the same couple of template tags and filters. I > > think some of these are general enough and useful enough that they > > should be considered for basic Django 1.2, even though they're fairly > > easy to write as add-ons. Here is my wishlist - please feel free to > > comment on any others that you would like to see and on any of mine > > where I've missed an obvious way to use the existing tags. > > > > > > Filter: get > > The built in dot (.) operator is great for accessing dictionary > > lookup, attribute lookup, etc. However, it doesn't work when the > > attribute/dictionary element is also a variable. I use a 'get' filter > > with code like: > > > > {% for k in keys %} > > Value for {{ k }} is {{ d|get:k }}<br/> > > {% endfor %} > > > > where I'd like to just write d.k > > What about allowing {{ d.'k' }} ? It's less typing, and maps more to > a dict lookup. > > And, you could still do {{ d.'k'|default:'Hello' }} for a default value, > > > Tag: ifstartswith > > I find this very useful in writing menus, navigation bars, etc. since > > I'm often checking whether the URL is within a given subdirectory. > > I'm a fan of having more if tags, but am not a fan of having if tags that > require me to remember all of the suffixes. Perhaps a smarter if tag in > general would be better... > > -- > http://www.apgwoz.com > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
