summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-05-01 16:14:57 +0000
committerJannis Leidel <jannis@leidel.info>2011-05-01 16:14:57 +0000
commitda3aa22d04d6452f87abbb1a0fee8a90a61eff5b (patch)
treec07b2314b514147845fe00a2b2f440d7f280c982 /django/utils
parent980455969eca41494ce997ccbcef44e4670a38b4 (diff)
Fixed #5714 -- Strip whitespaces around date and time form field values before converting it to a native type. Thanks to SmileyChris for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16137 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/formats.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/django/utils/formats.py b/django/utils/formats.py
index 0dc23402f2..e176985791 100644
--- a/django/utils/formats.py
+++ b/django/utils/formats.py
@@ -2,11 +2,12 @@ import decimal
import datetime
from django.conf import settings
-from django.utils.translation import get_language, to_locale, check_for_language
+from django.utils import dateformat, numberformat, datetime_safe
from django.utils.importlib import import_module
from django.utils.encoding import smart_str
-from django.utils import dateformat, numberformat, datetime_safe
+from django.utils.functional import lazy
from django.utils.safestring import mark_safe
+from django.utils.translation import get_language, to_locale, check_for_language
# format_cache is a mapping from (format_type, lang) to the format string.
# By using the cache, it is possible to avoid running get_format_modules
@@ -81,6 +82,8 @@ def get_format(format_type, lang=None, use_l10n=None):
_format_cache[cache_key] = None
return getattr(settings, format_type)
+get_format_lazy = lazy(get_format, unicode, list, tuple)
+
def date_format(value, format=None, use_l10n=None):
"""
Formats a datetime.date or datetime.datetime object using a