1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Merge pull request #1113 from denibertovic/master

Fixed #18761 -- Added whitespace stripping to URLField and SlugField.
This commit is contained in:
Aymeric Augustin
2013-05-18 07:11:11 -07:00
2 changed files with 16 additions and 0 deletions

View File

@@ -670,6 +670,10 @@ class URLField(CharField):
value = urlunsplit(url_fields)
return value
def clean(self, value):
value = self.to_python(value).strip()
return super(URLField, self).clean(value)
class BooleanField(Field):
widget = CheckboxInput
@@ -1105,3 +1109,7 @@ class GenericIPAddressField(CharField):
class SlugField(CharField):
default_validators = [validators.validate_slug]
def clean(self, value):
value = self.to_python(value).strip()
return super(SlugField, self).clean(value)