File: boundfield.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 (88 lines) | stat: -rw-r--r-- 3,145 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
from collections.abc import Iterable, Iterator
from typing import Any, TypeAlias, overload

from django.forms.fields import Field
from django.forms.forms import BaseForm
from django.forms.renderers import BaseRenderer
from django.forms.utils import ErrorList, RenderableFieldMixin
from django.forms.widgets import Widget
from django.utils.functional import _StrOrPromise, cached_property
from django.utils.safestring import SafeString

_AttrsT: TypeAlias = dict[str, str | bool]

class BoundField(RenderableFieldMixin):
    form: BaseForm
    field: Field
    name: str
    html_name: str
    html_initial_name: str
    html_initial_id: str
    label: _StrOrPromise
    help_text: _StrOrPromise
    renderer: BaseRenderer
    def __init__(self, form: BaseForm, field: Field, name: str) -> None: ...
    @cached_property
    def subwidgets(self) -> list[BoundWidget]: ...
    def __bool__(self) -> bool: ...
    def __iter__(self) -> Iterator[BoundWidget]: ...
    def __len__(self) -> int: ...
    @overload
    def __getitem__(self, idx: int | str) -> BoundWidget: ...
    @overload
    def __getitem__(self, idx: slice) -> list[BoundWidget]: ...
    @property
    def errors(self) -> ErrorList: ...
    @property
    def template_name(self) -> str: ...
    def as_widget(
        self, widget: Widget | None = None, attrs: _AttrsT | None = None, only_initial: bool = False
    ) -> SafeString: ...
    def as_text(self, attrs: _AttrsT | None = None, **kwargs: Any) -> SafeString: ...
    def __html__(self) -> SafeString: ...
    def as_textarea(self, attrs: _AttrsT | None = None, **kwargs: Any) -> SafeString: ...
    def as_hidden(self, attrs: _AttrsT | None = None, **kwargs: Any) -> SafeString: ...
    @property
    def data(self) -> Any: ...
    def value(self) -> Any: ...
    def label_tag(
        self,
        contents: str | None = None,
        attrs: _AttrsT | None = None,
        label_suffix: str | None = None,
        tag: str | None = None,
    ) -> SafeString: ...
    def legend_tag(
        self, contents: str | None = None, attrs: _AttrsT | None = None, label_suffix: str | None = None
    ) -> SafeString: ...
    def css_classes(self, extra_classes: str | Iterable[str] | None = None) -> str: ...
    @property
    def is_hidden(self) -> bool: ...
    @property
    def auto_id(self) -> str: ...
    @property
    def id_for_label(self) -> str: ...
    @property
    def initial(self) -> Any: ...
    def build_widget_attrs(self, attrs: _AttrsT, widget: Widget | None = None) -> _AttrsT: ...
    @property
    def widget_type(self) -> str: ...
    @property
    def use_fieldset(self) -> bool: ...
    @property
    def aria_describedby(self) -> str | None: ...

class BoundWidget:
    parent_widget: Widget
    data: dict[str, Any]
    renderer: BaseRenderer
    def __init__(self, parent_widget: Widget, data: dict[str, Any], renderer: BaseRenderer) -> None: ...
    def tag(self, wrap_label: bool = False) -> SafeString: ...
    @property
    def template_name(self) -> str: ...
    @property
    def id_for_label(self) -> str: ...
    @property
    def choice_label(self) -> str: ...

__all__ = ("BoundField",)