﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36328	Deserialization of RangeFields not interpreting the range bounds into Python types	Sebastian Albert		"I ran into an issue using Django REST Framework on a simple model with a field of type `DateRangeField`:
When POSTing a new instance to DRFs list view via a JSON body with the field's key mapped to the value [""2025-04-14"", ""2025-05-15""]
the new instance is saved, but the immediately returned page is an error, indicating that `.isoformat()` has been called on an object of type `str` [1], which is ""2025-04-14"" in my example. Apparently, the `RangeField` deserialization [2] did not deserialize the range bounds into the type of the Range's `base_field` [3]. psycopg seems to handle this without issue, but as the deserialized object is used in the view to be serialized again, this doesn't work out.

I am entirely new to Django, but from what I understand, I *think* the instance of `DateRangeField` should have bounds of type `date` and not `str`.

Retrieving the successfully saved entity via a subsequent `GET` works fine, which is in line with that reasoning, as psycopg returns Postgres' `daterange` bounds as `date` instances.

[1] https://github.com/django/django/blob/5.2/django/contrib/postgres/fields/ranges.py#L128
[2] https://github.com/django/django/blob/5.2/django/contrib/postgres/fields/ranges.py#L98-L108
[2] https://github.com/django/django/blob/5.2/django/contrib/postgres/fields/ranges.py#L204"	Bug	closed	contrib.postgres	5.2	Normal	needsinfo	range,serialization,postgres		Unreviewed	0	0	0	0	0	0
