Skip to content


At the heart of Proper Forms is the Form class. A form contain your field definitions, delegate validation, take input, and in general function as the glue holding everything together.

Form are classes that inherit from the proper_forms.Form class. You then create instances of those classes in your controllers, using the request and maybe object data.

from proper_forms  import Form, Email, Password

class LoginForm(Form):
    login = Email(required=True)
    password = Password(required=True)


def login():
    form = LoginForm(request.POST)
    if request.method == "POST" and form.validate():
    return render_template("login.html", form=form)

Form attributes#

Form(input_data=None, object=None, file_data=None, *, prefix="")


A MultiDict containing the data from a form request. Form requests are typically POST requests and many web frameworks returns it under the name request.POST.


Pre-existing data used to populate the form. This can be a dictionary or an instance of a class, typically an ORM Model.


Optional MultiDict with the file data. In some web frameworks this data can be read from the rest of the POST data, so you don’t need to (or can) include it again here.

In other frameworks, like Flask, this data is called request.files.


Optional namespace for the form.

Form methods#


[ TODO ]


[ TODO ]


[ TODO ]


[ TODO ]


This method can be used to replace the data passed when instantiating the form. Eg:

form = Form()
form.load_data(input_data, object_data)