Skip to content

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

@jdorel

Description

@jdorel

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") }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions