Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8164901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:25:05+00:00 2026-06-06T19:25:05+00:00

I have a simple model forms, that is being rendered through the following jinja2

  • 0

I have a simple model forms, that is being rendered through the following jinja2 template:

<form method="POST" action=""> 
    <table>
      {% for field in form %}   

      <tr>{{ field.label }}</tr>
      <tr>{{ field()|safe }}</tr>

      <tr>
        {% if field.errors %}
        <td>
          <ul class=errors>
            {% for error in field.errors %}
            <li>{{ error }}</li>
            {% endfor %}
          </ul>
        </td>
        {% endif %}
        {% endfor %}
    </table>
    <input type="submit" class="btn"  value="Submit Form"/>
  </form>

I wanted to customize the output of the wtforms and to each of the form fields being rendered, i wanted to add a class "required" to use a jquery client side validation plugin.

Following is my appengine db model:

class Song(db.Model):
    title = db.StringProperty()
    lyrics = db.TextProperty()
    duration = db.IntegerProperty()
    movie = db.ReferenceProperty(Movie)
    singer = db.ReferenceProperty(Singer)

and following is my form, rendering script:

SubTaskForm = model_form(Song, 
                         exclude=('movie', 'singer'),
                         )

What would be a good way to attach validators using wtfroms validators, also how can i attach a class=required to the form fields?

Let me know how to do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:25:07+00:00Added an answer on June 6, 2026 at 7:25 pm

    One way would be to override the stuff in python, where you define them, another thing that can be done is, you might try in the templates itself, <tr class="required">
    Give it a try, should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple html form and some php that input the POST variables
I have a simple form in Django that looks like this: class SettingForm(forms.Form): theme
I have an MVC form for adding a simple entity. I am using TextBoxFor(model
I have a fairly simple form with a checkbox, and I noticed that my
I have a form being submitted for a complex model including many associations. I
Lets say I have a working form that looks like the following =form_for @survey
I have to create a simple form that uses JSP for the view with
I have a simple modal form which I'd like to close when Esc is
I have a simple model like this: class User < ActiveRecord::Base serialize :preferences end
I have a simple model class (Part), which pulls from it's information from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.