[1.7.x] Prevented evaluation of a possible lazy message

As far as possible, message evaluation should not happen in field
__init__ (often run at import time).
Backport of cecbb71312 from master.
This commit is contained in:
Claude Paroz 2014-06-21 11:17:10 +02:00
parent d107c7bd7d
commit 0cabf3aefb
1 changed files with 1 additions and 1 deletions

View File

@ -527,7 +527,7 @@ class RegexField(CharField):
'Enter a valid value' is too generic for you. 'Enter a valid value' is too generic for you.
""" """
# error_message is just kept for backwards compatibility: # error_message is just kept for backwards compatibility:
if error_message: if error_message is not None:
error_messages = kwargs.get('error_messages') or {} error_messages = kwargs.get('error_messages') or {}
error_messages['invalid'] = error_message error_messages['invalid'] = error_message
kwargs['error_messages'] = error_messages kwargs['error_messages'] = error_messages