summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2019-08-18 11:40:11 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-08-18 20:34:58 +0200
commitd1c2e6dd04d4ddc8ace17e6abfed16ac46459d1e (patch)
tree89284f40bbda4237df30210356608d2b2d2b9ab6 /docs
parentaf69842dbd98e69519f1263eca2619c3165ba13b (diff)
Refs #28428 -- Made FileField.upload_to support pathlib.Path.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/fields.txt11
-rw-r--r--docs/releases/3.0.txt2
2 files changed, 10 insertions, 3 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index c267501bf4..01a56c1312 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -629,9 +629,10 @@ Has two optional arguments:
and can be set in two ways. In both cases, the value is passed to the
:meth:`Storage.save() <django.core.files.storage.Storage.save>` method.
- If you specify a string value, it may contain :func:`~time.strftime`
- formatting, which will be replaced by the date/time of the file upload (so
- that uploaded files don't fill up the given directory). For example::
+ If you specify a string value or a :class:`~pathlib.Path`, it may contain
+ :func:`~time.strftime` formatting, which will be replaced by the date/time
+ of the file upload (so that uploaded files don't fill up the given
+ directory). For example::
class MyModel(models.Model):
# file will be uploaded to MEDIA_ROOT/uploads
@@ -679,6 +680,10 @@ Has two optional arguments:
class MyModel(models.Model):
upload = models.FileField(upload_to=user_directory_path)
+ .. versionchanged:: 3.0
+
+ Support for :class:`pathlib.Path` was added.
+
.. attribute:: FileField.storage
A storage object, which handles the storage and retrieval of your
diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt
index b6b3368337..2e345f6fe5 100644
--- a/docs/releases/3.0.txt
+++ b/docs/releases/3.0.txt
@@ -304,6 +304,8 @@ Models
a certain (database-dependent) limit. Values from ``1`` to ``32767`` are safe
in all databases supported by Django.
+* :attr:`.FileField.upload_to` now supports :class:`pathlib.Path`.
+
Requests and Responses
~~~~~~~~~~~~~~~~~~~~~~