Tests
Test: attribute
Template
{% for item in items|rejectattr('id', 'odd') %}
{{ item.name }}
{% endfor %}
Data
{
"items": [
{ "id": 1, "name": "alpha" },
{ "id": 2, "name": "bravo" },
{ "id": 3, "name": "delta" }
]
}
Output Django (error) v1.10.1
'for' statements should use the format 'for x in y': for item in items|rejectattr('id', 'odd')
Output Jinja2 v2.8.0
bravo
Output Liquid v3.0.6
alpha
bravo
delta
Output Nunjucks (error) v2.5.0
(no output)
Output Swig (error) v1.4.2
Invalid filter "rejectattr".
Output Twig (error) v1.24.2
Unknown "rejectattr" filter.
Output Twigjs (error) v0.9.5
Unable to find filter rejectattr
Test: default
Template
{% for item in items|rejectattr('is_selected') %}
{{ item.name }}
{% endfor %}
Data
{
"items": [
{ "name": "alpha", "is_selected": false },
{ "name": "bravo", "is_selected": true },
{ "name": "delta", "is_selected": true }
]
}
Output Django (error) v1.10.1
Invalid filter: 'rejectattr'
Output Jinja2 v2.8.0
alpha
Output Liquid v3.0.6
alpha
bravo
delta
Output Nunjucks v2.5.0
alpha
Output Swig (error) v1.4.2
Invalid filter "rejectattr".
Output Twig (error) v1.24.2
Unknown "rejectattr" filter.
Output Twigjs (error) v0.9.5
Unable to find filter rejectattr