Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions django-stubs/contrib/postgres/forms/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .array import *
from .hstore import *
from .jsonb import *
from .ranges import *
41 changes: 41 additions & 0 deletions django-stubs/contrib/postgres/forms/array.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from typing import Any, Optional

from django import forms as forms

class SimpleArrayField(forms.CharField):
default_error_messages: Any = ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If attribute is defined on the base class, no need to define it on every field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in 55abc1e

base_field: Any = ...
delimiter: str = ...
min_length: Any = ...
max_length: Any = ...
def __init__(self, base_field: Any, *, delimiter: str = ..., max_length: Optional[Any] = ..., min_length: Optional[Any] = ..., **kwargs: Any) -> None: ...
def clean(self, value: Any): ...
def prepare_value(self, value: Any): ...
def to_python(self, value: Any): ...
def validate(self, value: Any) -> None: ...
def run_validators(self, value: Any) -> None: ...

class SplitArrayWidget(forms.Widget):
template_name: str = ...
widget: Any = ...
size: int = ...
def __init__(self, widget: Any, size: int, **kwargs: Any) -> None: ...
@property
def is_hidden(self): ...
def value_from_datadict(self, data: Any, files: Any, name: Any): ...
def value_omitted_from_data(self, data: Any, files: Any, name: Any): ...
def id_for_label(self, id_: Any): ...
def get_context(self, name: Any, value: Any, attrs: Optional[Any] = ...): ...
@property
def media(self): ...
def __deepcopy__(self, memo: Any): ...
@property
def needs_multipart_form(self): ...

class SplitArrayField(forms.Field):
default_error_messages: Any = ...
base_field: Any = ...
size: int = ...
remove_trailing_nulls: Any = ...
def __init__(self, base_field: Any, size: int, *, remove_trailing_nulls: bool = ..., **kwargs: Any) -> None: ...
def clean(self, value: Any): ...
9 changes: 9 additions & 0 deletions django-stubs/contrib/postgres/forms/hstore.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django import forms
from typing import Any

class HStoreField(forms.CharField):
widget: Any = ...
default_error_messages: Any = ...
def prepare_value(self, value: Any): ...
def to_python(self, value: Any): ...
def has_changed(self, initial: Any, data: Any): ...
12 changes: 12 additions & 0 deletions django-stubs/contrib/postgres/forms/jsonb.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django import forms
from typing import Any

class InvalidJSONInput(str): ...
class JSONString(str): ...

class JSONField(forms.CharField):
default_error_messages: Any = ...
widget: Any = ...
def to_python(self, value: Any): ...
def bound_data(self, data: Any, initial: Any): ...
def prepare_value(self, value: Any): ...
33 changes: 33 additions & 0 deletions django-stubs/contrib/postgres/forms/ranges.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from django import forms
from django.forms.widgets import MultiWidget
from typing import Any, Optional

class BaseRangeField(forms.MultiValueField):
default_error_messages: Any = ...
def __init__(self, **kwargs: Any) -> None: ...
def prepare_value(self, value: Any): ...
def compress(self, values: Any): ...

class IntegerRangeField(BaseRangeField):
default_error_messages: Any = ...
base_field: Any = ...
range_type: Any = ...

class FloatRangeField(BaseRangeField):
default_error_messages: Any = ...
base_field: Any = ...
range_type: Any = ...

class DateTimeRangeField(BaseRangeField):
default_error_messages: Any = ...
base_field: Any = ...
range_type: Any = ...

class DateRangeField(BaseRangeField):
default_error_messages: Any = ...
base_field: Any = ...
range_type: Any = ...

class RangeWidget(MultiWidget):
def __init__(self, base_widget: Any, attrs: Optional[Any] = ...) -> None: ...
def decompress(self, value: Any): ...
5 changes: 5 additions & 0 deletions django-stubs/contrib/postgres/utils.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from typing import Any, Mapping

from django.core.exceptions import ValidationError

def prefix_validation_error(error: ValidationError, prefix: str, code: str, params: Mapping) -> ValidationError: ...