Form View

class pyramid_views.views.edit.FormView(**kwargs)

A view for displaying a form, and rendering a template response.

success_url = None
form_class = None
get_form_class()

Returns the form class to use in this view

get_form(form_class)

Returns an instance of the form to be used in this view.

form_invalid(form)

If the form is invalid, re-render the context data with the data-filled form and errors.

form_valid(form)

If the form is valid, redirect to the supplied URL.

Note

Override this method if you wish to perform an action on successful form submission (Eg: For a contact form you may wish to send an email).

prefix = None
get_prefix()

Returns the prefix to use for forms on this view

initial = {}
get_initial()

Returns the initial data to use for forms on this view.

get_form_kwargs()

Returns the keyword arguments for instantiating the form.

template_name = None
content_type = None
get_context_data(**kwargs)
get(request, *args, **kwargs)
post(request, *args, **kwargs)

Handles POST requests, instantiating a form instance with the passed POST variables and then checked for validity.