add django 3.1 jsonfield

This commit is contained in:
Maksim Kurnikov
2021-01-19 22:13:36 +03:00
parent 58c087f7f5
commit 159f8b95ba
3 changed files with 21 additions and 82 deletions

View File

@@ -60,6 +60,7 @@ from .fields.files import (
FileDescriptor as FileDescriptor,
)
from .fields.proxy import OrderWrt as OrderWrt
from .fields.json import JSONField as JSONField
from .deletion import (
CASCADE as CASCADE,

View File

@@ -2,103 +2,43 @@ from . import Field
from .mixins import CheckFieldDefaultMixin
from django.db.models import lookups
from django.db.models.lookups import PostgresOperatorLookup, Transform
from typing import Any, Optional
from typing import Any, Optional, Callable
class JSONField(CheckFieldDefaultMixin, Field):
empty_strings_allowed: bool = ...
description: Any = ...
default_error_messages: Any = ...
encoder: Any = ...
decoder: Any = ...
def __init__(
self,
verbose_name: Optional[Any] = ...,
name: Optional[Any] = ...,
encoder: Optional[Any] = ...,
decoder: Optional[Any] = ...,
verbose_name: Optional[str] = ...,
name: Optional[str] = ...,
encoder: Optional[Callable] = ...,
decoder: Optional[Callable] = ...,
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any): ...
def deconstruct(self): ...
def from_db_value(self, value: Any, expression: Any, connection: Any): ...
def get_internal_type(self): ...
def get_prep_value(self, value: Any): ...
def get_transform(self, name: Any): ...
def validate(self, value: Any, model_instance: Any) -> None: ...
def value_to_string(self, obj: Any): ...
def formfield(self, **kwargs: Any): ...
class DataContains(PostgresOperatorLookup):
lookup_name: str = ...
postgres_operator: str = ...
def as_sql(self, compiler: Any, connection: Any): ...
class DataContains(PostgresOperatorLookup): ...
class ContainedBy(PostgresOperatorLookup): ...
class ContainedBy(PostgresOperatorLookup):
lookup_name: str = ...
postgres_operator: str = ...
def as_sql(self, compiler: Any, connection: Any): ...
class HasKeyLookup(PostgresOperatorLookup):
logical_operator: Any = ...
def as_sql(self, compiler: Any, connection: Any, template: Optional[Any] = ...): ...
def as_mysql(self, compiler: Any, connection: Any): ...
def as_oracle(self, compiler: Any, connection: Any): ...
lhs: Any = ...
rhs: Any = ...
def as_postgresql(self, compiler: Any, connection: Any): ...
def as_sqlite(self, compiler: Any, connection: Any): ...
class HasKey(HasKeyLookup):
lookup_name: str = ...
postgres_operator: str = ...
prepare_rhs: bool = ...
class HasKeys(HasKeyLookup):
lookup_name: str = ...
postgres_operator: str = ...
logical_operator: str = ...
def get_prep_lookup(self): ...
class HasAnyKeys(HasKeys):
lookup_name: str = ...
postgres_operator: str = ...
logical_operator: str = ...
class JSONExact(lookups.Exact):
can_use_none_as_rhs: bool = ...
def process_rhs(self, compiler: Any, connection: Any): ...
class HasKeyLookup(PostgresOperatorLookup): ...
class HasKey(HasKeyLookup): ...
class HasKeys(HasKeyLookup): ...
class HasAnyKeys(HasKeys): ...
class JSONExact(lookups.Exact): ...
class KeyTransform(Transform):
postgres_operator: str = ...
postgres_nested_operator: str = ...
key_name: Any = ...
def __init__(self, key_name: Any, *args: Any, **kwargs: Any) -> None: ...
def preprocess_lhs(self, compiler: Any, connection: Any, lhs_only: bool = ...): ...
def as_mysql(self, compiler: Any, connection: Any): ...
def as_oracle(self, compiler: Any, connection: Any): ...
def as_postgresql(self, compiler: Any, connection: Any): ...
class KeyTextTransform(KeyTransform):
postgres_operator: str = ...
postgres_nested_operator: str = ...
class KeyTextTransform(KeyTransform): ...
class KeyTransformTextLookupMixin:
def __init__(self, key_transform: Any, *args: Any, **kwargs: Any) -> None: ...
class CaseInsensitiveMixin:
def process_rhs(self, compiler: Any, connection: Any): ...
class KeyTransformIsNull(lookups.IsNull):
def as_oracle(self, compiler: Any, connection: Any): ...
def as_sqlite(self, compiler: Any, connection: Any): ...
class KeyTransformIn(lookups.In):
def process_rhs(self, compiler: Any, connection: Any): ...
class KeyTransformExact(JSONExact):
def process_rhs(self, compiler: Any, connection: Any): ...
def as_oracle(self, compiler: Any, connection: Any): ...
class CaseInsensitiveMixin: ...
class KeyTransformIsNull(lookups.IsNull): ...
class KeyTransformIn(lookups.In): ...
class KeyTransformExact(JSONExact): ...
class KeyTransformIExact(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IExact): ...
class KeyTransformIContains(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IContains): ...
class KeyTransformStartsWith(KeyTransformTextLookupMixin, lookups.StartsWith): ...
@@ -108,9 +48,7 @@ class KeyTransformIEndsWith(CaseInsensitiveMixin, KeyTransformTextLookupMixin, l
class KeyTransformRegex(KeyTransformTextLookupMixin, lookups.Regex): ...
class KeyTransformIRegex(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IRegex): ...
class KeyTransformNumericLookupMixin:
def process_rhs(self, compiler: Any, connection: Any): ...
class KeyTransformNumericLookupMixin: ...
class KeyTransformLt(KeyTransformNumericLookupMixin, lookups.LessThan): ...
class KeyTransformLte(KeyTransformNumericLookupMixin, lookups.LessThanOrEqual): ...
class KeyTransformGt(KeyTransformNumericLookupMixin, lookups.GreaterThan): ...

View File

@@ -60,7 +60,7 @@ class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin):
) -> Any: ...
class PostgresOperatorLookup(FieldGetDbPrepValueMixin, Lookup):
postgres_operator: Any = ...
postgres_operator: str = ...
def as_postgresql(self, compiler: Any, connection: Any): ...
class Exact(FieldGetDbPrepValueMixin, BuiltinLookup): ...