The implementation that you have made is only valid from Django 1.6+. Compare: 1.6 docs to 1.5.
Before 1.6, messages were immediately converted to strings in django.core.exceptions.ValidationError
(see code here):
class ValidationError(Exception):
"""An error while validating data."""
def __init__(self, message, code=None, params=None):
import operator
from django.utils.encoding import force_text
"""
ValidationError can be passed any object that can be printed (usually
a string), a list of objects or a dictionary.
"""
if isinstance(message, dict):
self.message_dict = message
# Reduce each list of messages into a single list.
message = reduce(operator.add, message.values())
if isinstance(message, list):
self.messages = [force_text(msg) for msg in message] #! Will output "u'<message>'"
In your case, instead of passing a list of ValidationError
instances, just pass a list of strings:
>>> e1 = 'This is the first error message'
>>> e2 = 'This is the second error message'
>>> error_list = [e1, e2]
>>> el = forms.ValidationError(error_list)
>>> el.messages
[u'This is the first error message', u'This is the second error message']