You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and expecting the result of 'somefilter' in sub.key in each element of the newly produced array.
I haven't found an easy way to achieve this with existing filters (but I might have missed something).
Obviously, this can be implemented in an extension, (I'd call that mapattr, I guess ?), but since this would be backward compatible with map (it would merely transform what is now an invalid call into a valid one : map(attribute='someattr', 'somefilter')
What do you think ? If the jinja project deems this a good idea, I can do the PR.
The text was updated successfully, but these errors were encountered:
Hello,
Could the map filter be able to combine both of its functionality, and apply a filter to an attribute before returning the whole structure ?
I'm often trying to use map in the following manner:
data | map(attribute='sub.key', 'somefilter', filter_args)
With data being:
and expecting the result of 'somefilter' in
sub.key
in each element of the newly produced array.I haven't found an easy way to achieve this with existing filters (but I might have missed something).
Obviously, this can be implemented in an extension, (I'd call that
mapattr
, I guess ?), but since this would be backward compatible with map (it would merely transform what is now an invalid call into a valid one :map(attribute='someattr', 'somefilter')
What do you think ? If the jinja project deems this a good idea, I can do the PR.
The text was updated successfully, but these errors were encountered: