﻿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
17840	Overriding form field error messages without argument causes string formatting error.	klein4	nobody	"Something like this in a form's __init__ method

{{{
self.fields['my_choice_field'].error_messages['invalid_choice'] = u'Constant string'
}}}

will throw an error because of the following line in django/forms/models.py (line 1015):

{{{
raise ValidationError(self.error_messages['invalid_choice'] % val)
}}}

This method of string formatting forces the user's custom error message to contain a '%s' argument, like the default error message does. A dictionary-based string formatting operation like

{{{
self.error_messages['invalid_choice'] % {'foo': bar}
}}}

would fix this problem."	Bug	closed	Forms	1.3	Normal	fixed			Accepted	1	0	0	0	0	0
