Ticket #8189: model-api.diff

File model-api.diff, 1.5 KB (added by Flavio Curella, 16 years ago)
  • Users/flavio/working_copies/django/docs/model-api.txt

     
    296296
    297297    3. All that will be stored in your database is a path to the file
    298298       (relative to ``MEDIA_ROOT``). You'll most likely want to use the
    299        convenience ``get_<fieldname>_url`` function provided by Django. For
     299       ``<fieldname>.url`` attribute provided by Django. For
    300300       example, if your ``ImageField`` is called ``mug_shot``, you can get
    301301       the absolute URL to your image in a template with ``{{
    302        object.get_mug_shot_url }}``.
     302       object.mug_shot.url }}``.
    303303
    304304For example, say your ``MEDIA_ROOT`` is set to ``'/home/media'``, and
    305305``upload_to`` is set to ``'photos/%Y/%m/%d'``. The ``'%Y/%m/%d'`` part of
     
    310310
    311311If you want to retrieve the upload file's on-disk filename, or a URL that
    312312refers to that file, or the file's size, you can use the
    313 ``get_FOO_filename()``, ``get_FOO_url()`` and ``get_FOO_size()`` methods.
     313``FOO.path``, ``FOO.url`` and ``FOO.size`` attributes.
    314314They are all documented here__.
    315315
    316 __ ../db-api/#get-foo-filename
     316__ ../files/#file-attributes-and-methods
    317317
    318318Note that whenever you deal with uploaded files, you should pay close attention
    319319to where you're uploading them and what type of files they are, to avoid
Back to Top