summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@sixmedia.com>2013-06-05 14:55:05 -0400
committerTim Graham <timograham@gmail.com>2013-06-18 08:01:17 -0400
commitee77d4b25360a9fc050c32769a334fd69a011a63 (patch)
tree1f20a040970dc53d2e4977d79fe66ea7626cd932 /django/utils
parentf34cfec0fa1243b4a3b9865b961a2360f211f0d8 (diff)
Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/ipv6.py5
1 files changed, 3 insertions, 2 deletions
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