File: widgets.pyi

package info (click to toggle)
python-django-stubs 5.2.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,832 kB
  • sloc: python: 5,185; makefile: 15; sh: 8
file content (161 lines) | stat: -rw-r--r-- 5,958 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
from collections.abc import Iterable, Mapping, Sequence
from typing import Any

from django import forms
from django.contrib.admin.sites import AdminSite
from django.core.files.base import File
from django.db.models.fields.reverse_related import ManyToManyRel, ManyToOneRel
from django.forms.models import ModelChoiceIterator
from django.forms.widgets import ChoiceWidget, _OptAttrs
from django.utils.choices import _Choices
from django.utils.functional import _StrOrPromise

class FilteredSelectMultiple(forms.SelectMultiple):
    verbose_name: _StrOrPromise
    is_stacked: bool
    def __init__(
        self,
        verbose_name: _StrOrPromise,
        is_stacked: bool,
        attrs: _OptAttrs | None = ...,
        choices: _Choices = ...,
    ) -> None: ...

class BaseAdminDateWidget(forms.DateInput):
    def __init__(self, attrs: _OptAttrs | None = ..., format: str | None = ...) -> None: ...

class AdminDateWidget(BaseAdminDateWidget):
    template_name: str

class BaseAdminTimeWidget(forms.TimeInput):
    def __init__(self, attrs: _OptAttrs | None = ..., format: str | None = ...) -> None: ...

class AdminTimeWidget(BaseAdminTimeWidget):
    template_name: str

class AdminSplitDateTime(forms.SplitDateTimeWidget):
    template_name: str
    def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...
    def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...

class AdminRadioSelect(forms.RadioSelect): ...
class AdminFileWidget(forms.ClearableFileInput): ...

def url_params_from_lookup_dict(lookups: Any) -> dict[str, str]: ...

class ForeignKeyRawIdWidget(forms.TextInput):
    rel: ManyToOneRel
    admin_site: AdminSite
    db: str | None
    def __init__(
        self,
        rel: ManyToOneRel,
        admin_site: AdminSite,
        attrs: _OptAttrs | None = ...,
        using: str | None = ...,
    ) -> None: ...
    def base_url_parameters(self) -> dict[str, str]: ...
    def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...
    def url_parameters(self) -> dict[str, str]: ...
    def label_and_url_for_value(self, value: Any) -> tuple[str, str]: ...

class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
    rel: ManyToManyRel  # type: ignore[assignment]
    def __init__(
        self,
        rel: ManyToManyRel,
        admin_site: AdminSite,
        attrs: _OptAttrs | None = ...,
        using: str | None = ...,
    ) -> None: ...
    def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...
    def url_parameters(self) -> dict[str, str]: ...
    def label_and_url_for_value(self, value: Any) -> tuple[str, str]: ...
    def format_value(self, value: Any) -> str | None: ...
    def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ...

class RelatedFieldWidgetWrapper(forms.Widget):
    template_name: str
    widget: ChoiceWidget
    rel: ManyToOneRel
    can_add_related: bool
    can_change_related: bool
    can_delete_related: bool
    can_view_related: bool
    admin_site: AdminSite
    def __init__(
        self,
        widget: ChoiceWidget,
        rel: ManyToOneRel,
        admin_site: AdminSite,
        can_add_related: bool | None = ...,
        can_change_related: bool = ...,
        can_delete_related: bool = ...,
        can_view_related: bool = ...,
    ) -> None: ...
    @property
    def is_hidden(self) -> bool: ...
    @property
    def choices(self) -> ModelChoiceIterator: ...
    @choices.setter
    def choices(self, value: ModelChoiceIterator) -> None: ...
    def get_related_url(self, info: tuple[str, str], action: str, *args: Any) -> str: ...
    def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...
    def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ...
    def value_omitted_from_data(
        self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str
    ) -> bool: ...
    def id_for_label(self, id_: str) -> str: ...

class AdminTextareaWidget(forms.Textarea):
    def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...

class AdminTextInputWidget(forms.TextInput):
    def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...

class AdminEmailInputWidget(forms.EmailInput):
    def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...

class AdminURLFieldWidget(forms.URLInput):
    template_name: str
    def __init__(self, attrs: _OptAttrs | None = ..., validator_class: Any = ...) -> None: ...
    def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...

class AdminIntegerFieldWidget(forms.NumberInput):
    def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...
    class_name: str

class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget):
    class_name: str

class AdminUUIDInputWidget(forms.TextInput):
    def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...

SELECT2_TRANSLATIONS: dict[str, str]

def get_select2_language() -> str | None: ...

class AutocompleteMixin:
    url_name: str
    field: Any
    admin_site: AdminSite
    db: str | None
    choices: Any
    attrs: _OptAttrs
    def __init__(
        self,
        field: Any,
        admin_site: AdminSite,
        attrs: _OptAttrs | None = ...,
        choices: Any = ...,
        using: str | None = ...,
    ) -> None: ...
    def get_url(self) -> str: ...
    def build_attrs(self, base_attrs: _OptAttrs, extra_attrs: _OptAttrs | None = ...) -> dict[str, Any]: ...
    # typo in source: `attr` instead of `attrs`
    def optgroups(
        self, name: str, value: Sequence[str], attr: _OptAttrs | None = ...
    ) -> list[tuple[str | None, list[dict[str, Any]], int | None]]: ...

class AutocompleteSelect(AutocompleteMixin, forms.Select): ...
class AutocompleteSelectMultiple(AutocompleteMixin, forms.SelectMultiple): ...