title: jinja2: reject a specific attribute from a dictionary
body: <p>I have the following dictionary:</p>
  
  <pre><code>d = {'name': 'Johnny', 'age': 23, '_id': 167, 'sport': 'golf'}
  </code></pre>
  
  <p>Using jinja2 I want to filter out (or reject) the <code>_id</code> key so I get the following dictionary (note this <code>_id</code> field is dynamic so I want to reject the key no matter what it's equal to):</p>
  
  <pre><code>{'name': 'Johnny', 'age': 23, 'sport': 'golf'}
  </code></pre>
  
  <p>I've tried using the built-in filters <code>reject</code> and <code>rejectattr</code> but it's not working as expected. This is what I've tried so far:</p>
  
  <pre><code>{{ d | rejectattr('_id') }}
  # &lt;generator object select_or_reject&gt;
  {{ d | rejectattr('_id', 'defined') }}
  # &lt;generator object select_or_reject&gt;
  {{ d | reject('_id', 'defined') }}
  # &lt;generator object select_or_reject&gt;
  </code></pre>