mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #35326 -- Added allow_overwrite parameter to FileSystemStorage.
This commit is contained in:
@@ -79,6 +79,9 @@ details on these changes.
|
||||
|
||||
* The ``check`` keyword argument of ``CheckConstraint`` will be removed.
|
||||
|
||||
* The ``OS_OPEN_FLAGS`` attribute of
|
||||
:class:`~django.core.files.storage.FileSystemStorage` will be removed.
|
||||
|
||||
.. _deprecation-removed-in-5.1:
|
||||
|
||||
5.1
|
||||
|
||||
@@ -28,7 +28,7 @@ Django provides convenient ways to access the default storage class:
|
||||
The ``FileSystemStorage`` class
|
||||
===============================
|
||||
|
||||
.. class:: FileSystemStorage(location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None)
|
||||
.. class:: FileSystemStorage(location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None, allow_overwrite=False)
|
||||
|
||||
The :class:`~django.core.files.storage.FileSystemStorage` class implements
|
||||
basic file storage on a local filesystem. It inherits from
|
||||
@@ -60,6 +60,13 @@ The ``FileSystemStorage`` class
|
||||
The file system permissions that the directory will receive when it is
|
||||
saved. Defaults to :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS`.
|
||||
|
||||
.. attribute:: allow_overwrite
|
||||
|
||||
.. versionadded:: 5.1
|
||||
|
||||
Flag to control allowing saving a new file over an existing one.
|
||||
Defaults to ``False``.
|
||||
|
||||
.. method:: get_created_time(name)
|
||||
|
||||
Returns a :class:`~datetime.datetime` of the system's ctime, i.e.
|
||||
|
||||
@@ -210,7 +210,10 @@ Error Reporting
|
||||
File Storage
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* ...
|
||||
* The :attr:`~django.core.files.storage.FileSystemStorage.allow_overwrite`
|
||||
parameter has been added to
|
||||
:class:`~django.core.files.storage.FileSystemStorage`, to allow saving new
|
||||
files over existing ones.
|
||||
|
||||
File Uploads
|
||||
~~~~~~~~~~~~
|
||||
@@ -467,6 +470,12 @@ Miscellaneous
|
||||
* The ``check`` keyword argument of ``CheckConstraint`` is deprecated in favor
|
||||
of ``condition``.
|
||||
|
||||
* The undocumented ``OS_OPEN_FLAGS`` property of
|
||||
:class:`~django.core.files.storage.FileSystemStorage` has been deprecated.
|
||||
To allow overwriting files in storage, set the new
|
||||
:attr:`~django.core.files.storage.FileSystemStorage.allow_overwrite` option
|
||||
to ``True`` instead.
|
||||
|
||||
Features removed in 5.1
|
||||
=======================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user