﻿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
12525	ModelForm validation doesn't work like documented	Bernd Schlapsi <brot@…>	nobody	"On http://docs.djangoproject.com/en/dev//ref/models/instances/#validating-objects there is the following sentence
{{{
However, if you are using a ModelForm, it will call full_validate for you, and present any errors along with the other form error messages.
}}}

But the !ModelForm doesn't use the validators which are defined on my model. This is my sample code:
{{{
from django import forms
from django.core.validators import MinLengthValidator
from django.db import models
   
class Person(models.Model):
    first_name = models.CharField(validators=[MinLengthValidator(3)])
    last_name = models.CharField(validators=[MinLengthValidator(3)])
    email = models.EmailField()
 
class PersonForm(forms.ModelForm):
    class Meta:
        model = Person

f = PersonForm({'first_name':'a', 'last_name':'b', 'email':'a.b@test.com'})
f.full_clean()
f.errors
}}}

This is the output from the last statement
{{{
{'email': [u'This field is required.']}
}}}

But the output should look something like, if the documentation is right
{{{
{'email': [u'This field is required.'],
 'first_name': [u'Ensure this value has at least 3 characters (it has 1).'],
 'last_name': [u'Ensure this value has at least 3 characters (it has 1).']}
}}}"		closed	Documentation	dev		fixed	Validators		Unreviewed	0	0	0	0	0	0
