Open vbabiy opened 3 weeks ago
You can work around this bug by defining custom fields:
class MyIntegerRangeField(IntegerRangeField):
range_type = Int4Range
class StuffSerializer(serializers.ModelSerializer):
numbers = MyIntegerRangeField(
default=Int4Range(lower=0, upper=86400),
required=False,
allow_null=True,
)
If you have a serializer like this with a
IntegerRangeField
At creation time it will create a query that has a double cast
'(,)'::numrange::int4range
This happens because
NumericRange
is casted by thepsycopq
transformer.