﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6845	Model validation and its propagation to ModelForms	Honza Král	Honza Král	"Hi all, during a sprint at PyCON 2008 I wrote first simple version of model validation.

Main features:
 * model fields can define list of validators (kwarg {{{validators}}}) - validator is a function that accepts one argument and throws {{{django.core.validation.validationError}}} if anything doesn't look right
 * models now have a validate method that
   * call the validation for fields
   * can be overridden to allow for custom validation
   * raises {{{django.core.validation.validationError}}} if anything goes amiss
 * formfields' {{{clean}}} method has been deprecated and split into two - {{{to_python}}} and {{{validate}}}
   * {{{to_python}}} does the type coersion, throws {{{django.core.validation.TypeCoersionError}}}
   * {{{validate}}} doesnt return anything, just raises an exception
   * new kwarg {{{validators}}} allows for passing validators to formfields as well
 * form method clean has been renamed to validate and also doesn't return anything.
   * hooks for validation individual fields on form should now be named {{{validate_FIELD_NAME}}} and take the value to validate as only parameter


Steps that remain to be done:
 * verify how much code has been broken by this
 * clean the code, update comments
 * add more tests for the new behavior
 * add documentation
 * add validation to formsets to validate for unique and unique_together across all the forms in the formset
 * allow to turn some of the validation off ???
  * unique(_together) for performance reasons
"		closed	Forms	dev		fixed	newforms validation model modelform ep2008	Christian Schilling listuser@… gabor@… yatiohi@… ondrej.kohohut@… bronger@… rajesh.dhawan@… model-validation@… erwin@… django-trac@… flori@… gonz@… aball@… public@… Jannis Leidel Eduardo de Oliveira Padoan Benjamin Schwarze remco@… piranha@… moya@… David Larlet Carlo Pires jim@…	Accepted	1	1	1	1	0	0
