mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 08:47:49 +08:00
Allows FileField storage to be a Callable (#453)
* Allows FileField storage to be a Callable The `storage` parameter of `FileField` (and by extension `ImageField`) is not limited to just taking an instance of `Storage`. It can also take a no-args callable that returns an instance of `Storage`. * correcting linting issue in forms.pyi
This commit is contained in:
@@ -39,7 +39,7 @@ class FileField(Field):
|
||||
def __init__(
|
||||
self,
|
||||
upload_to: Union[str, Callable, Path] = ...,
|
||||
storage: Optional[Storage] = ...,
|
||||
storage: Optional[Union[Storage, Callable[[], Storage]]] = ...,
|
||||
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||
name: Optional[str] = ...,
|
||||
max_length: Optional[int] = ...,
|
||||
|
||||
@@ -70,7 +70,12 @@ class BaseForm:
|
||||
def visible_fields(self): ...
|
||||
def get_initial_for_field(self, field: Field, field_name: str) -> Any: ...
|
||||
def _html_output(
|
||||
self, normal_row: str, error_row: str, row_ender: str, help_text_html: str, errors_on_separate_row: bool,
|
||||
self,
|
||||
normal_row: str,
|
||||
error_row: str,
|
||||
row_ender: str,
|
||||
help_text_html: str,
|
||||
errors_on_separate_row: bool,
|
||||
) -> SafeText: ...
|
||||
|
||||
class Form(BaseForm):
|
||||
|
||||
Reference in New Issue
Block a user