diff --git a/django/core/validators.py b/django/core/validators.py
index 95224e9..20d08f4 100644
a
|
b
|
email_re = re.compile(
|
164 | 164 | r'|\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]$', re.IGNORECASE) # literal form, ipv4 address (SMTP 4.1.3) |
165 | 165 | validate_email = EmailValidator(email_re, _(u'Enter a valid e-mail address.'), 'invalid') |
166 | 166 | |
167 | | slug_re = re.compile(r'^[-\w]+$') |
168 | | validate_slug = RegexValidator(slug_re, _(u"Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens."), 'invalid') |
| 167 | slug_re = re.compile(r'^[-\w]+$', re.U) |
| 168 | validate_slug = RegexValidator(slug_re, _(u"Enter a valid 'slug' consisting of unicode letters, numbers, underscores or hyphens."), 'invalid') |
169 | 169 | |
170 | 170 | ipv4_re = re.compile(r'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$') |
171 | 171 | validate_ipv4_address = RegexValidator(ipv4_re, _(u'Enter a valid IPv4 address.'), 'invalid') |
diff --git a/docs/ref/validators.txt b/docs/ref/validators.txt
index 0f29989..2759c7d 100644
a
|
b
|
to, or in lieu of custom ``field.clean()`` methods.
|
118 | 118 | |
119 | 119 | ``validate_slug`` |
120 | 120 | ----------------- |
| 121 | .. versionadded:: 1.4 |
| 122 | |
121 | 123 | .. data:: validate_slug |
122 | 124 | |
123 | 125 | A :class:`RegexValidator` instance that ensures a value consists of only |
124 | | letters, numbers, underscores or hyphens. |
| 126 | unicode letters, numbers, underscores or hyphens. |
125 | 127 | |
126 | 128 | ``validate_ipv4_address`` |
127 | 129 | ------------------------- |
diff --git a/tests/modeltests/validators/tests.py b/tests/modeltests/validators/tests.py
index a1a48bf..dc6f567 100644
a
|
b
|
TEST_DATA = (
|
38 | 38 | (validate_slug, 'longer-slug-still-ok', None), |
39 | 39 | (validate_slug, '--------', None), |
40 | 40 | (validate_slug, 'nohyphensoranything', None), |
| 41 | (validate_slug, '你好', None), |
41 | 42 | |
42 | 43 | (validate_slug, '', ValidationError), |
43 | 44 | (validate_slug, ' text ', ValidationError), |
44 | 45 | (validate_slug, ' ', ValidationError), |
45 | 46 | (validate_slug, 'some@mail.com', ValidationError), |
46 | | (validate_slug, '你好', ValidationError), |
| 47 | (validate_slug, '你 好', ValidationError), |
47 | 48 | (validate_slug, '\n', ValidationError), |
48 | 49 | |
49 | 50 | (validate_ipv4_address, '1.1.1.1', None), |