diff --git a/AUTHORS b/AUTHORS
index b7c0994f0c..d6547cd919 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -34,6 +34,7 @@ answer newbie questions, and generally made Django that much better:
akaihola
Andreas
David Ascher
+ Arthur
James Bennett
Paul Bissex
Simon Blanchard
diff --git a/django/core/management.py b/django/core/management.py
index ca457aa706..ff902d2e10 100644
--- a/django/core/management.py
+++ b/django/core/management.py
@@ -58,10 +58,11 @@ def _get_contenttype_insert(opts):
def _is_valid_dir_name(s):
return bool(re.search(r'^\w+$', s))
-# If the foreign key points to an AutoField, the foreign key should be an
-# IntegerField, not an AutoField. Otherwise, the foreign key should be the same
-# type of field as the field to which it points.
-get_rel_data_type = lambda f: (f.get_internal_type() == 'AutoField') and 'IntegerField' or f.get_internal_type()
+# If the foreign key points to an AutoField, a PositiveIntegerField or a
+# PositiveSmallIntegerField, the foreign key should be an IntegerField, not the
+# referred field type. Otherwise, the foreign key should be the same type of
+# field as the field to which it points.
+get_rel_data_type = lambda f: (f.get_internal_type() in ('AutoField', 'PositiveIntegerField', 'PositiveSmallIntegerField')) and 'IntegerField' or f.get_internal_type()
def get_sql_create(app):
"Returns a list of the CREATE TABLE SQL statements for the given app."
diff --git a/django/db/backends/util.py b/django/db/backends/util.py
index a9d78dcfde..01503bf086 100644
--- a/django/db/backends/util.py
+++ b/django/db/backends/util.py
@@ -52,6 +52,7 @@ def typecast_timestamp(s): # does NOT store time zone information
# "2005-07-29 15:48:00.590358-05"
# "2005-07-29 09:56:00-05"
if not s: return None
+ if not ' ' in s: return typecast_date(s)
d, t = s.split()
# Extract timezone information, if it exists. Currently we just throw
# it away, but in the future we may make use of it.
diff --git a/django/utils/html.py b/django/utils/html.py
index d89067106e..9e239cad1f 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -38,8 +38,8 @@ def strip_tags(value):
return re.sub(r'<[^>]*?>', '', value)
def strip_spaces_between_tags(value):
- "Returns the given HTML with spaces between tags stripped"
- return re.sub(r'>\s+<', '><', value)
+ "Returns the given HTML with spaces between tags normalized to a single space"
+ return re.sub(r'>\s+<', '> <', value)
def strip_entities(value):
"Returns the given HTML with all entities (&something;) stripped"
diff --git a/docs/templates.txt b/docs/templates.txt
index 0fbe1f6ae8..3dafb068c3 100644
--- a/docs/templates.txt
+++ b/docs/templates.txt
@@ -668,7 +668,8 @@ spaceless
**New in Django development version.**
-Strips whitespace between HTML tags. This includes tab characters and newlines.
+Normalizes whitespace between HTML tags to a single space. This includes tab
+characters and newlines.
Example usage::
@@ -680,9 +681,9 @@ Example usage::
This example would return this HTML::
- Foo
+ Foo
-Only space between *tags* is stripped -- not space between tags and text. In
+Only space between *tags* is normalized -- not space between tags and text. In
this example, the space around ``Hello`` won't be stripped::
{% spaceless %}