Cleaning form data in Django
11,332
You can define clean_FIELD_NAME() methods which can validate and alter data, as documented here: http://docs.djangoproject.com/en/dev/ref/forms/validation/#ref-forms-validation
Author by
Aether McLoud
Updated on June 19, 2022Comments
-
Aether McLoud almost 2 years
How can i clean and modify data from a form in django. I would like to define it on a per field basis for each model, much like using ModelForms.
What I want to achieve is automatically remove leading and trailing spaces from defined fields, or turn a title (from one field) into a slug (which would be another field).
-
user1066101 over 15 yearsAlso the overall clean() method of the Form.