mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 04:04:26 +08:00
Improve type of BaseForms.files (#350)
This is valid Django, which failed to pass with the old type-defintion:
class MyForm(Form):
myparam = MultiFileField(...)
self.clean(self, *args, **kwargs):
self.files.getlist('myparam', [])
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Type, Union
|
||||
|
||||
from django.core.exceptions import ValidationError as ValidationError
|
||||
from django.core.files import uploadedfile
|
||||
from django.forms.boundfield import BoundField
|
||||
from django.forms.fields import Field
|
||||
from django.forms.renderers import BaseRenderer
|
||||
from django.forms.utils import ErrorDict, ErrorList
|
||||
from django.forms.widgets import Media, MediaDefiningClass
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
class DeclarativeFieldsMetaclass(MediaDefiningClass): ...
|
||||
@@ -18,7 +20,7 @@ class BaseForm:
|
||||
use_required_attribute: bool = ...
|
||||
is_bound: bool = ...
|
||||
data: Dict[str, Any] = ...
|
||||
files: Optional[Dict[str, Any]] = ...
|
||||
files: MultiValueDict[str, uploadedfile.UploadedFile] = ...
|
||||
auto_id: str = ...
|
||||
initial: Dict[str, Any] = ...
|
||||
error_class: Type[ErrorList] = ...
|
||||
|
||||
Reference in New Issue
Block a user