Ticket #30621: ranges.diff

File ranges.diff, 713 bytes (added by Tilman Koschnick, 5 years ago)
  • ranges.py

    old new  
    170170        params = lhs_params + rhs_params
    171171        # Cast the rhs if needed.
    172172        cast_sql = ''
    173         if isinstance(self.rhs, models.Expression) and self.rhs._output_field_or_none:
     173        if isinstance(self.rhs, models.Expression) and self.rhs._output_field_or_none and not isinstance(self.rhs.output_field, (DateRangeField, DateTimeRangeField)):
    174174            cast_internal_type = self.lhs.output_field.base_field.get_internal_type()
    175175            cast_sql = '::{}'.format(connection.data_types.get(cast_internal_type))
    176176        return '%s @> %s%s' % (lhs, rhs, cast_sql), params
Back to Top