summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-08-15 21:07:48 +0200
committerClaude Paroz <claude@2xlibre.net>2012-08-15 21:07:48 +0200
commit2b157b0adc5cbe4fb0161f8319aca809b32eeae0 (patch)
tree2d305079ffcfcbf4250e50ec4f1cbf9a46277e8c
parent60f5e1023066b92270d01aa121efe228f6edc379 (diff)
[py3] Fixed slug regex
In Python 3, \w matches any Unicode character.
-rw-r--r--django/core/validators.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/core/validators.py b/django/core/validators.py
index 34c397506f..1a714c5472 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -99,7 +99,7 @@ email_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}\]$', re.IGNORECASE) # literal form, ipv4 address (SMTP 4.1.3)
validate_email = EmailValidator(email_re, _('Enter a valid e-mail address.'), 'invalid')
-slug_re = re.compile(r'^[-\w]+$')
+slug_re = re.compile(r'^[-a-zA-Z0-9_]+$')
validate_slug = RegexValidator(slug_re, _("Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens."), 'invalid')
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}$')