#36078: Postgres date and time range fields change after saving object
--------------------------+--------------------------------------------
Reporter: Mapiarz | Type: Bug
Status: new | Component: contrib.postgres
Version: 4.2 | Severity: Normal
Keywords: postgres | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------+--------------------------------------------
This short test exemplifies the problem:
{{{
now = timezone.now()
empty_range = psycopg2_range.DateTimeTZRange(empty=True)
test_model = TestModel(range=psycopg2_range.DateTimeTZRange(now, now))
self.assertFalse(test_model.range.isempty)
self.assertNotEqual(test_model.range, empty_range)
test_model.save()
test_model.refresh_from_db()
self.assertTrue(test_model.range.isempty)
self.assertEqual(test_model.range, empty_range)
}}}
I would expect the field value not to change after saving, and it should
continue to have the lower, upper and boundary fields set.
Repro project:
https://github.com/Mapiarz/django_postgres_range_repro/tree/master
--
Ticket URL: <https://code.djangoproject.com/ticket/36078>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701944b93e199-bacf7660-407e-4c53-b0b8-71b1a4f56f4e-000000%40eu-central-1.amazonses.com.