(self, compiler, connection)
| 386 | return super().get_prep_lookup() |
| 387 | |
| 388 | def as_sql(self, compiler, connection): |
| 389 | # Avoid comparison against direct rhs if lhs is a boolean value. That |
| 390 | # turns "boolfield__exact=True" into "WHERE boolean_field" instead of |
| 391 | # "WHERE boolean_field = True" when allowed. |
| 392 | if ( |
| 393 | isinstance(self.rhs, bool) |
| 394 | and getattr(self.lhs, "conditional", False) |
| 395 | and connection.ops.conditional_expression_supported_in_where_clause( |
| 396 | self.lhs |
| 397 | ) |
| 398 | ): |
| 399 | lhs_sql, params = self.process_lhs(compiler, connection) |
| 400 | template = "%s" if self.rhs else "NOT %s" |
| 401 | return template % lhs_sql, params |
| 402 | return super().as_sql(compiler, connection) |
| 403 | |
| 404 | |
| 405 | @Field.register_lookup |
nothing calls this directly
no test coverage detected