|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
3 |
| -from typing import Any, Callable, Iterable, cast |
| 3 | +from typing import Any, Callable, cast |
4 | 4 |
|
5 | 5 | from django.core import checks
|
6 | 6 | from django.db.backends.base.base import BaseDatabaseWrapper
|
7 | 7 | from django.db.models import CharField, Field, IntegerField, Lookup, Model, TextField
|
8 | 8 | from django.db.models.expressions import BaseExpression
|
| 9 | +from django.db.models.sql.compiler import SQLCompiler |
9 | 10 | from django.forms import Field as FormField
|
10 | 11 | from django.utils.translation import gettext_lazy as _
|
11 | 12 |
|
@@ -221,10 +222,10 @@ def __init__(self, index: int, *args: Any, **kwargs: Any) -> None:
|
221 | 222 | self.index = index
|
222 | 223 |
|
223 | 224 | def as_sql(
|
224 |
| - self, qn: Callable[[str], str], connection: BaseDatabaseWrapper |
225 |
| - ) -> tuple[str, Iterable[Any]]: |
226 |
| - lhs, lhs_params = self.process_lhs(qn, connection) |
227 |
| - rhs, rhs_params = self.process_rhs(qn, connection) |
| 225 | + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper |
| 226 | + ) -> tuple[str, list[str | int]]: |
| 227 | + lhs, lhs_params = self.process_lhs(compiler, connection) |
| 228 | + rhs, rhs_params = self.process_rhs(compiler, connection) |
228 | 229 | params = tuple(lhs_params) + tuple(rhs_params)
|
229 | 230 | # Put rhs on the left since that's the order FIND_IN_SET uses
|
230 | 231 | return f"(FIND_IN_SET({rhs}, {lhs}) = {self.index})", params
|
|
0 commit comments