Ticket #5192: 0001-contrib.flatpages-URL-can-now-contain-tilde.patch
| File 0001-contrib.flatpages-URL-can-now-contain-tilde.patch, 1.5 kB (added by ctrochalakis, 4 months ago) |
|---|
-
a/django/contrib/flatpages/models.py
old new 1 import re 2 1 3 from django.core import validators 2 4 from django.db import models 3 5 from django.contrib.sites.models import Site 4 6 from django.utils.translation import ugettext_lazy as _ 7 from django.core.validators import ValidationError 8 9 validURL_re = re.compile(r'^[-\w/~]+$') 10 11 def isValidURL(field_data, all_data): 12 if not validURL_re.search(field_data): 13 raise ValidationError, _("This value must contain only letters, numbers, underscores, dashes, the tilde, or slashes.") 5 14 6 15 class FlatPage(models.Model): 7 url = models.CharField(_('URL'), max_length=100, validator_list=[ validators.isAlphaNumericURL], db_index=True,16 url = models.CharField(_('URL'), max_length=100, validator_list=[isValidURL], db_index=True, 8 17 help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes.")) 9 18 title = models.CharField(_('title'), max_length=200) 10 19 content = models.TextField(_('content'))
