mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 12:44:29 +08:00
fix form errors in CI
This commit is contained in:
@@ -41,6 +41,7 @@ class BaseFormSet(Sized, Mapping[str, Any]):
|
|||||||
def management_form(self): ...
|
def management_form(self): ...
|
||||||
def total_form_count(self): ...
|
def total_form_count(self): ...
|
||||||
def initial_form_count(self): ...
|
def initial_form_count(self): ...
|
||||||
|
@property
|
||||||
def forms(self): ...
|
def forms(self): ...
|
||||||
def get_form_kwargs(self, index: Any): ...
|
def get_form_kwargs(self, index: Any): ...
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, Sequence, MutableMapping
|
from typing import Any, Callable, Dict, Iterator, List, MutableMapping, Optional, Sequence, Tuple, Type, Union
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from django.core.files.base import File
|
from django.core.files.base import File
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import ForeignKey
|
from django.db.models import ForeignKey
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
@@ -16,9 +15,7 @@ from django.forms.fields import CharField, ChoiceField, Field
|
|||||||
from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass
|
from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass
|
||||||
from django.forms.formsets import BaseFormSet
|
from django.forms.formsets import BaseFormSet
|
||||||
from django.forms.utils import ErrorList
|
from django.forms.utils import ErrorList
|
||||||
from django.forms.widgets import Input, Widget, Select
|
from django.forms.widgets import Input, Widget
|
||||||
from django.http.request import QueryDict
|
|
||||||
from django.utils.datastructures import MultiValueDict
|
|
||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
ALL_FIELDS: str
|
ALL_FIELDS: str
|
||||||
@@ -97,7 +94,7 @@ def modelform_factory(
|
|||||||
help_texts: Optional[MutableMapping[str, str]] = ...,
|
help_texts: Optional[MutableMapping[str, str]] = ...,
|
||||||
error_messages: Optional[MutableMapping[str, Dict[str, Any]]] = ...,
|
error_messages: Optional[MutableMapping[str, Dict[str, Any]]] = ...,
|
||||||
field_classes: Optional[MutableMapping[str, Type[Field]]] = ...,
|
field_classes: Optional[MutableMapping[str, Type[Field]]] = ...,
|
||||||
) -> ModelForm: ...
|
) -> Type[ModelForm]: ...
|
||||||
|
|
||||||
class BaseModelFormSet(BaseFormSet):
|
class BaseModelFormSet(BaseFormSet):
|
||||||
model: Any = ...
|
model: Any = ...
|
||||||
@@ -155,7 +152,7 @@ def modelformset_factory(
|
|||||||
error_messages: Optional[Dict[str, Dict[str, str]]] = ...,
|
error_messages: Optional[Dict[str, Dict[str, str]]] = ...,
|
||||||
validate_min: bool = ...,
|
validate_min: bool = ...,
|
||||||
field_classes: Optional[Dict[str, Type[Field]]] = ...,
|
field_classes: Optional[Dict[str, Type[Field]]] = ...,
|
||||||
) -> BaseModelFormSet: ...
|
) -> Type[BaseModelFormSet]: ...
|
||||||
|
|
||||||
class BaseInlineFormSet(BaseModelFormSet):
|
class BaseInlineFormSet(BaseModelFormSet):
|
||||||
instance: Any = ...
|
instance: Any = ...
|
||||||
@@ -200,7 +197,7 @@ def inlineformset_factory(
|
|||||||
min_num: Optional[int] = ...,
|
min_num: Optional[int] = ...,
|
||||||
validate_min: bool = ...,
|
validate_min: bool = ...,
|
||||||
field_classes: Optional[Dict[str, Any]] = ...,
|
field_classes: Optional[Dict[str, Any]] = ...,
|
||||||
) -> Any: ...
|
) -> Type[BaseInlineFormSet]: ...
|
||||||
|
|
||||||
class InlineForeignKeyField(Field):
|
class InlineForeignKeyField(Field):
|
||||||
disabled: bool
|
disabled: bool
|
||||||
|
|||||||
@@ -232,6 +232,12 @@ IGNORED_ERRORS = {
|
|||||||
+ 'base class "ImageFieldTestMixin" defined the type as "Type[PersonWithHeightAndWidth]")',
|
+ 'base class "ImageFieldTestMixin" defined the type as "Type[PersonWithHeightAndWidth]")',
|
||||||
'note: "Person" defined here'
|
'note: "Person" defined here'
|
||||||
],
|
],
|
||||||
|
'model_formsets': [
|
||||||
|
'Incompatible types in string interpolation (expression has type "object", placeholder has type "Union[int, float]")'
|
||||||
|
],
|
||||||
|
'model_formsets_regress': [
|
||||||
|
'Incompatible types in assignment (expression has type "Model", variable has type "User")'
|
||||||
|
],
|
||||||
'model_regress': [
|
'model_regress': [
|
||||||
'Too many arguments for "Worker"',
|
'Too many arguments for "Worker"',
|
||||||
re.compile(r'Incompatible type for "[a-z]+" of "Worker" \(got "int", expected')
|
re.compile(r'Incompatible type for "[a-z]+" of "Worker" \(got "int", expected')
|
||||||
|
|||||||
Reference in New Issue
Block a user