Skip to content

Commit ae4c932

Browse files
authored
Complete JSONObject (#2560)
1 parent b1426a6 commit ae4c932

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

django-stubs/db/models/functions/comparison.pyi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from typing import Any, ClassVar
22

3+
from django.db.backends.base.base import BaseDatabaseWrapper
34
from django.db.models import Func
45
from django.db.models.expressions import Combinable
56
from django.db.models.fields import Field
67
from django.db.models.fields.json import JSONField
8+
from django.db.models.sql.compiler import SQLCompiler, _AsSqlType
79

810
class Cast(Func):
911
def __init__(self, expression: Combinable | str, output_field: str | Field) -> None: ...
@@ -16,8 +18,16 @@ class Collate(Func):
1618
class Greatest(Func): ...
1719

1820
class JSONObject(Func):
19-
def __init__(self, **fields: Any) -> None: ...
2021
output_field: ClassVar[JSONField]
22+
def __init__(self, **fields: Any) -> None: ...
23+
def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... # type: ignore [override]
24+
def as_native(
25+
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, *, returning: str, **extra_context: Any
26+
) -> _AsSqlType: ...
27+
def as_postgresql(
28+
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any
29+
) -> _AsSqlType: ...
30+
def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
2131

2232
class Least(Func): ...
2333
class NullIf(Func): ...

scripts/stubtest/allowlist_todo.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,9 +949,6 @@ django.db.models.functions.Cot.as_oracle
949949
django.db.models.functions.Degrees.as_oracle
950950
django.db.models.functions.Extract.as_sql
951951
django.db.models.functions.Extract.lookup_name
952-
django.db.models.functions.JSONObject.as_oracle
953-
django.db.models.functions.JSONObject.as_postgresql
954-
django.db.models.functions.JSONObject.as_sql
955952
django.db.models.functions.Now.as_mysql
956953
django.db.models.functions.Now.as_postgresql
957954
django.db.models.functions.NullIf.as_oracle
@@ -967,9 +964,6 @@ django.db.models.functions.comparison.Coalesce.as_oracle
967964
django.db.models.functions.comparison.Coalesce.empty_result_set_value
968965
django.db.models.functions.comparison.Collate.as_sql
969966
django.db.models.functions.comparison.Collate.collation_re
970-
django.db.models.functions.comparison.JSONObject.as_oracle
971-
django.db.models.functions.comparison.JSONObject.as_postgresql
972-
django.db.models.functions.comparison.JSONObject.as_sql
973967
django.db.models.functions.comparison.NullIf.as_oracle
974968
django.db.models.functions.datetime.Extract.as_sql
975969
django.db.models.functions.datetime.Extract.lookup_name

scripts/stubtest/allowlist_todo_django51.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ django.db.models.fields.related.RelatedField.cache_name
8080
django.db.models.fields.reverse_related.ForeignObjectRel.accessor_name
8181
django.db.models.fields.reverse_related.ForeignObjectRel.cache_name
8282
django.db.models.functions.ConcatPair.pipes_concat_sql
83-
django.db.models.functions.JSONObject.as_native
84-
django.db.models.functions.comparison.JSONObject.as_native
8583
django.db.models.functions.text.ConcatPair.pipes_concat_sql
8684
django.db.models.lookups.In.get_refs
8785
django.forms.ModelChoiceField.validate_no_null_characters

0 commit comments

Comments
 (0)