Updated handling of ValidationError to work with Django 1.6.