minijinja::filters

Function rejectattr

Source
pub fn rejectattr(
    state: &State<'_, '_>,
    value: Value,
    attr: Cow<'_, str>,
    test_name: Option<Cow<'_, str>>,
    args: Rest<Value>,
) -> Result<Vec<Value>, Error>
Expand description

Creates a new sequence of values of which an attribute does not pass a test.

This functions like select but it will test an attribute of the object itself:

{{ users|rejectattr("is_active") }} -> all users where x.is_active is false
{{ users|rejectattr("id", "even") }} -> returns all users with an odd id