I can filter a list in jinja using selectattr, for example if I want the elements for which foo is None:
lists | selectattr('foo','none')
but how can I negate this? How can I get all elements for which foo is not none?
All the block tag does is tell the template engine that a child template may override those placeholders in the template. In your example, the base template (header. html) has a default value for the content block, which is everything inside that block. By setting a value in home.
{{ lists | rejectattr('foo', 'none') }}
http://jinja.pocoo.org/docs/dev/templates/#rejectattr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With