Opened 9 years ago

Closed 9 years ago

#4623 closed (fixed)

Needs newforms description of how to "do form processing"

Reported by: cellmap@… Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: newforms
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I couldn't figure out how to do my own form processing for days... then I learned it was as simple as:

form = MyForm(request.POST)
if form.is_valid():

# Capture data, store to DB.
mymodel.title = form.clean_datatitle?
mymodel.description = form.clean_datadescription?
mymodel.save()

is_valid() cleans the incoming POST data, and stores the result in form.clean_data[]

Change History (1)

comment:1 Changed 9 years ago by James Bennett

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: fixed
Status: newclosed

The section Using forms in views and templates covers a full example of using a form to validate data. If this doesn't cover what you're looking for, please open a new ticket with specific suggestions.

Note: See TracTickets for help on using tickets.
Back to Top