diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-11-25 09:25:43 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-11-25 09:25:43 +0000 |
| commit | 866c229f52df29f6b7b07463548532aae421fe42 (patch) | |
| tree | f5de4cec5cc22e9468f7e0ae3dd1d3897e1363b3 /tests/modeltests | |
| parent | e954a03871cdc1c155ba7a3f3000dcf75998d9f4 (diff) | |
Fixed #17294 -- Supported nullable DateTimeFields when time zone support is enabled. Thanks pressureman for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests')
| -rw-r--r-- | tests/modeltests/timezones/models.py | 3 | ||||
| -rw-r--r-- | tests/modeltests/timezones/tests.py | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/tests/modeltests/timezones/models.py b/tests/modeltests/timezones/models.py index bd488d1132..9296edf924 100644 --- a/tests/modeltests/timezones/models.py +++ b/tests/modeltests/timezones/models.py @@ -3,6 +3,9 @@ from django.db import models class Event(models.Model): dt = models.DateTimeField() +class MaybeEvent(models.Model): + dt = models.DateTimeField(blank=True, null=True) + class Timestamp(models.Model): created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) diff --git a/tests/modeltests/timezones/tests.py b/tests/modeltests/timezones/tests.py index 53b14045ab..5d86e9322e 100644 --- a/tests/modeltests/timezones/tests.py +++ b/tests/modeltests/timezones/tests.py @@ -25,7 +25,7 @@ from django.utils.tzinfo import FixedOffset from django.utils.unittest import skipIf from .forms import EventForm, EventSplitForm, EventModelForm -from .models import Event, Timestamp +from .models import Event, MaybeEvent, Timestamp # These tests use the EAT (Eastern Africa Time) and ICT (Indochina Time) @@ -403,6 +403,11 @@ class NewDatabaseTests(BaseDateTimeTests): datetime.datetime(2011, 1, 1, tzinfo=UTC)], transform=lambda d: d) + def test_null_datetime(self): + # Regression for #17294 + e = MaybeEvent.objects.create() + self.assertEqual(e.dt, None) + NewDatabaseTests = override_settings(USE_TZ=True)(NewDatabaseTests) |
