(self, compiler, connection)
| 243 | return super().process_rhs(compiler, connection) |
| 244 | |
| 245 | def as_postgresql(self, compiler, connection): |
| 246 | sql, params = super().as_postgresql(compiler, connection) |
| 247 | # Cast the rhs if needed. |
| 248 | cast_sql = "" |
| 249 | if ( |
| 250 | isinstance(self.rhs, models.Expression) |
| 251 | and self.rhs._output_field_or_none |
| 252 | and |
| 253 | # Skip cast if rhs has a matching range type. |
| 254 | not isinstance( |
| 255 | self.rhs._output_field_or_none, self.lhs.output_field.__class__ |
| 256 | ) |
| 257 | ): |
| 258 | cast_internal_type = self.lhs.output_field.base_field.get_internal_type() |
| 259 | cast_sql = "::{}".format(connection.data_types.get(cast_internal_type)) |
| 260 | return "%s%s" % (sql, cast_sql), params |
| 261 | |
| 262 | |
| 263 | DateRangeField.register_lookup(DateTimeRangeContains) |
nothing calls this directly
no test coverage detected