From ee77d4b25360a9fc050c32769a334fd69a011a63 Mon Sep 17 00:00:00 2001 From: Loic Bistuer Date: Wed, 5 Jun 2013 14:55:05 -0400 Subject: Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields --- django/utils/ipv6.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'django/utils') diff --git a/django/utils/ipv6.py b/django/utils/ipv6.py index eaacfb4623..4d5352272b 100644 --- a/django/utils/ipv6.py +++ b/django/utils/ipv6.py @@ -2,10 +2,11 @@ # Copyright 2007 Google Inc. http://code.google.com/p/ipaddr-py/ # Licensed under the Apache License, Version 2.0 (the "License"). from django.core.exceptions import ValidationError +from django.utils.translation import ugettext_lazy as _ from django.utils.six.moves import xrange def clean_ipv6_address(ip_str, unpack_ipv4=False, - error_message="This is not a valid IPv6 address."): + error_message=_("This is not a valid IPv6 address.")): """ Cleans a IPv6 address string. @@ -31,7 +32,7 @@ def clean_ipv6_address(ip_str, unpack_ipv4=False, doublecolon_len = 0 if not is_valid_ipv6_address(ip_str): - raise ValidationError(error_message) + raise ValidationError(error_message, code='invalid') # This algorithm can only handle fully exploded # IP strings -- cgit v1.3