Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type hints for JSONField.from_db_value #1879

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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