Skip to content

Commit

Permalink
Fixed #8189, another use of get_FOO_url() missed in the docs after fi…
Browse files Browse the repository at this point in the history
…lestorage.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8335 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jacobian committed Aug 12, 2008
1 parent bb30805 commit cb1368b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/model-api.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -295,11 +295,10 @@ specified storage system takes a few steps:
subdirectory of ``MEDIA_ROOT`` it should upload files. subdirectory of ``MEDIA_ROOT`` it should upload files.


3. All that will be stored in your database is a path to the file 3. All that will be stored in your database is a path to the file
(relative to ``MEDIA_ROOT``). You'll most likely want to use the (relative to ``MEDIA_ROOT``). You'll most likely want to use
convenience ``get_<fieldname>_url`` function provided by Django. For ``object.<field>.url`` to get the actual URL. For example, if your
example, if your ``ImageField`` is called ``mug_shot``, you can get ``ImageField`` is called ``mug_shot``, you can get the absolute URL to
the absolute URL to your image in a template with ``{{ your image in a template with ``{{ object.mug_shot.url }}``.
object.get_mug_shot_url }}``.


For example, say your ``MEDIA_ROOT`` is set to ``'/home/media'``, and For example, say your ``MEDIA_ROOT`` is set to ``'/home/media'``, and
``upload_to`` is set to ``'photos/%Y/%m/%d'``. The ``'%Y/%m/%d'`` part of ``upload_to`` is set to ``'photos/%Y/%m/%d'``. The ``'%Y/%m/%d'`` part of
Expand Down

0 comments on commit cb1368b

Please sign in to comment.