Fix #15646: Document that a FileField's full path can't be relied upon until its model has been saved to the database. Thanks poirier.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
549c495875
commit
c8c71057aa
|
@ -572,6 +572,11 @@ information on the available attributes and methods, see the
|
||||||
:class:`~django.core.files.File` class reference and the :doc:`/topics/files`
|
:class:`~django.core.files.File` class reference and the :doc:`/topics/files`
|
||||||
topic guide.
|
topic guide.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
The file is saved as part of saving the model in the database, so the actual
|
||||||
|
file name used on disk cannot be relied on until after the model has been
|
||||||
|
saved.
|
||||||
|
|
||||||
The uploaded file's relative URL can be obtained using the
|
The uploaded file's relative URL can be obtained using the
|
||||||
:attr:`~django.db.models.fields.FileField.url` attribute. Internally,
|
:attr:`~django.db.models.fields.FileField.url` attribute. Internally,
|
||||||
this calls the :meth:`~django.core.files.storage.Storage.url` method of the
|
this calls the :meth:`~django.core.files.storage.Storage.url` method of the
|
||||||
|
|
|
@ -45,6 +45,12 @@ the details of the attached photo::
|
||||||
This object -- ``car.photo`` in the example -- is a ``File`` object, which means
|
This object -- ``car.photo`` in the example -- is a ``File`` object, which means
|
||||||
it has all the methods and attributes described below.
|
it has all the methods and attributes described below.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
The file is saved as part of saving the model in the database, so the actual
|
||||||
|
file name used on disk cannot be relied on until after the model has been
|
||||||
|
saved.
|
||||||
|
|
||||||
|
|
||||||
The ``File`` object
|
The ``File`` object
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue