title: How to get WTForms Validator in jinja2
body: <p>What I would like to do is check what type of form validators a form object has so that I can render the field with based on those attributes. For example if the form has max-length validation then add the max-length property to the html form.</p>
  
  <p>I was thinking of it working something like this: </p>
  
  <pre><code>zip_code = TextField('Zip Code', [validators.Length(min=5, max=11)])
  </code></pre>
  
  <p>will go to a Jinja2 macro like so:</p>
  
  <pre><code>{% if field.valdator "has max length" %}
    {% set class = class + ' maxlength="11" ' %}
  {% endif %}
  {{ field(class=class, **kwargs) }}
  </code></pre>