Skip to content

Commit

Permalink
Add type hints for JSONField.from_db_value (#1879)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaeppe committed Dec 16, 2023
1 parent 29c74e6 commit ec9a5e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 2 additions & 0 deletions django-stubs/db/models/fields/json.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ from typing import Any, ClassVar

from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import lookups
from django.db.models.expressions import Expression
from django.db.models.fields import TextField
from django.db.models.lookups import PostgresOperatorLookup, Transform
from django.db.models.sql.compiler import SQLCompiler
Expand All @@ -24,6 +25,7 @@ class JSONField(CheckFieldDefaultMixin, Field):
decoder: type[json.JSONDecoder] | None = ...,
**kwargs: Any,
) -> None: ...
def from_db_value(self, value: str | None, expression: Expression, connection: BaseDatabaseWrapper) -> Any: ...

class DataContains(PostgresOperatorLookup): ...
class ContainedBy(PostgresOperatorLookup): ...
Expand Down
3 changes: 0 additions & 3 deletions scripts/stubtest/allowlist_todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ django.contrib.gis.db.models.IntegerField.class_lookups
django.contrib.gis.db.models.IntegerField.formfield
django.contrib.gis.db.models.JSONField.class_lookups
django.contrib.gis.db.models.JSONField.formfield
django.contrib.gis.db.models.JSONField.from_db_value
django.contrib.gis.db.models.JSONField.get_transform
django.contrib.gis.db.models.Lookup.get_prep_lhs
django.contrib.gis.db.models.Lookup.lookup_name
Expand Down Expand Up @@ -979,7 +978,6 @@ django.db.models.IntegerField.class_lookups
django.db.models.IntegerField.formfield
django.db.models.JSONField.class_lookups
django.db.models.JSONField.formfield
django.db.models.JSONField.from_db_value
django.db.models.JSONField.get_transform
django.db.models.Lookup.get_prep_lhs
django.db.models.Lookup.lookup_name
Expand Down Expand Up @@ -1196,7 +1194,6 @@ django.db.models.fields.json.HasKeyLookup.as_sql
django.db.models.fields.json.HasKeyLookup.as_sqlite
django.db.models.fields.json.JSONField.class_lookups
django.db.models.fields.json.JSONField.formfield
django.db.models.fields.json.JSONField.from_db_value
django.db.models.fields.json.JSONField.get_transform
django.db.models.fields.json.KeyTextTransform.as_mysql
django.db.models.fields.json.KeyTransform.as_mysql
Expand Down

0 comments on commit ec9a5e2

Please sign in to comment.