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 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

This comment has been minimized.

Copy link
Contributor

@EtiennePelletier EtiennePelletier commented May 7, 2019

I'm working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.