Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] default filter on dictionnary and undefined parent key #977

Closed
jdorel opened this issue May 2, 2019 · 1 comment · Fixed by #997
Closed

[Feature Request] default filter on dictionnary and undefined parent key #977

jdorel opened this issue May 2, 2019 · 1 comment · Fixed by #997
Milestone

Comments

@jdorel
Copy link

jdorel commented May 2, 2019

Expected Behavior

If the parent key non_existent_key does not exist, the print statement should print the default value string.

For details (and some workarounds found by the community), see:

Actual Behavior

If the parent key does not exist, it throws an error.

Template Code

{{ mydict.non_existent_key.var | default("string") }}
@EtiennePelletier
Copy link
Contributor

I'm working on this.

@davidism davidism added this to the 2.11 milestone May 9, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants