summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-10 05:26:40 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-10 05:26:40 +0000
commitc545e88b817f299c7bb04c68a392cb5d52e7109b (patch)
tree433d3660374a63ec5c32c9419e0a48039adfeec4 /tests
parent9c770e05d448deeea6d0d9a27eb5a9f3805435c5 (diff)
[1.0.X] Fixed #10443 -- Fixed model attribute updating after r10004.
Adding a get_db_prep_save() call to the UpdateQuery code path meant it was being called twice if you updated an existing model attribute. This change removes that double call and also makes TimeField.to_python() a little more robust for the benefit of the Oracle backend (just in case). Backport of r10013 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10014 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/model_regress/models.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/regressiontests/model_regress/models.py b/tests/regressiontests/model_regress/models.py
index 3c87e1c1e9..4bd27f2383 100644
--- a/tests/regressiontests/model_regress/models.py
+++ b/tests/regressiontests/model_regress/models.py
@@ -1,5 +1,9 @@
# coding: utf-8
+import datetime
+
+from django.conf import settings
from django.db import models
+from django.utils import tzinfo
CHOICES = (
(1, 'first'),
@@ -140,5 +144,24 @@ datetime.datetime(2000, 1, 1, 6, 1, 1)
>>> BrokenUnicodeMethod.objects.all()
[<BrokenUnicodeMethod: [Bad Unicode data]>]
+"""}
+
+if settings.DATABASE_ENGINE != "mysql":
+ __test__["non-mysql-tests"] = """
+# Saving an updating with timezone-aware datetime Python objects. Regression
+# test for #10443.
+
+# The idea is that all these creations and saving should work without crashing.
+# It's not rocket science.
+>>> Article.objects.all().delete()
+>>> dt1 = datetime.datetime(2008, 8, 31, 16, 20, tzinfo=tzinfo.FixedOffset(600))
+>>> dt2 = datetime.datetime(2008, 8, 31, 17, 20, tzinfo=tzinfo.FixedOffset(600))
+>>> obj = Article.objects.create(headline="A headline", pub_date=dt1, article_text="foo")
+
+>>> obj.pub_date = dt2
+>>> obj.save()
+>>> Article.objects.filter(headline="A headline").update(pub_date=dt1)
+1
+
"""
-}
+