title: How do I register filters for dynamically-generated jinja2 templates in Flask?
body: <p>I am new to Flask. I am trying to generate my template dynamically so that I can make a request via AJAX and append rows to a table:</p>
  
  <pre><code>@app.template_filter('my_multiplier')
  def my_multiplier(n):
    return n*10
  
  @app.route('/')
  def index():
    content = [1,2,3,4,5]
    tmplate = get_template()
    html = tmplate.render(content=content)
    return render_template('index.jinja2',html=html)
  
  
  def get_template():
    html = Template(u'''\
      {% for n in conent %}
      &lt;tr&gt;&lt;td&gt;{{ n | my_multiplier }}&lt;/td&gt;&lt;/tr&gt;   
      {% endfor %}''')
    return html
  </code></pre>
  
  <p>I get an error: TemplateAssertionError: no filter named 'my_multiplier'</p>
  
  <p>What am I doing wrong? (The template renders fine if I exclude the filter)</p>