title: jinja2.exceptions.UndefinedError: 'render_field' is undefined
body: <p>So I just started using <code>Wtforms</code> in conjunction with <code>Flask</code>, I set up basic class and defined all of my fields in <code>forms.py</code> as you can see here...</p>
  
  <pre><code>from wtforms import Form, TextField, validators, PasswordField, DateField
  
  class AddAccount(Form):
      username = TextField('Username', [validators.Length('min=3, max=20')])
      email = TextField('Email', [validators.Length('min=1, max=255')])
      karma = TextField('Karma', [validators.Length('min=1, max=10000000')])
      password = PasswordField('Password', [validators.Length('min=6, max=255')])
  </code></pre>
  
  <p>then I imported the <code>AddAccount</code> class into <code>views.py</code> as you can see here...</p>
  
  <pre><code>from forms import AddAccount
  
  @app.route('/dashboard/add', methods=['POST', 'GET'])
  def add_account():
  
      form = AddAccount(request.form)
  
      if request.method == 'POST' and form.validate():
          print('POST request')
  
  
      return render_template('add_account.html', form=form)
  </code></pre>
  
  <p>and here's the template file...</p>
  
  <pre><code>{% extends 'layout.html' %}
  
  {% block body %}
      &lt;br&gt;
      &lt;div class="jumbotron text-center"&gt;
         &lt;h1&gt;Add an Account&lt;/h1&gt;
         &lt;hr&gt;
         &lt;form action="{{url_for('add_account')}}"&gt;
              &lt;div class="form-group"&gt;
                  {{render_field(form.username, class_='form-control')}}
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  {{render_field(form.email, class_='form-control')}}    
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  {{render_field(form.password, class_='form-control')}}
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  {{render_field(form.karma, class_='form-control')}}
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>That whole contraption cause this error <code>jinja2.exceptions.UndefinedError: 'render_field' is undefined</code> and I have absolutely no idea why it's happening or how to fix it. Any help will be appreciated.</p>
  
  <p>And if it helps... here's the stack trace...</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1997, in __call__
      return self.wsgi_app(environ, start_response)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1985, in wsgi_app
      response = self.handle_exception(e)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1540, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\_compat.py", line 33, in reraise
      raise value
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1982, in wsgi_app
      response = self.full_dispatch_request()
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\_compat.py", line 33, in reraise
      raise value
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
      rv = self.dispatch_request()
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1598, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File "E:\Python\manager\views.py", line 37, in add_account
      return render_template('add_account.html', form=form)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\templating.py", line 134, in render_template
      context, ctx.app)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\templating.py", line 116, in _render
      rv = template.render(context)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\jinja2\asyncsupport.py", line 76, in render
      return original_render(self, *args, **kwargs)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\jinja2\environment.py", line 1008, in render
      return self.environment.handle_exception(exc_info, True)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "C:\Users\Hassan\AppData\Local\Programs\Python\Python36\lib\site-packages\jinja2\_compat.py", line 37, in reraise
      raise value.with_traceback(tb)
    File "E:\Python\manager\templates\add_account.html", line 1, in top-level template code
      {% extends 'layout.html' %}
    File "E:\Python\manager\templates\layout.html", line 22, in top-level template code
      {% block body %}{% endblock %}
    File "E:\Python\manager\templates\add_account.html", line 10, in block "body"
      {{render_field(form.username, class_='form-control')}}
  jinja2.exceptions.UndefinedError: 'render_field' is undefined
  </code></pre>