Cleaned up FAQ changes from [303]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@305 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
371144f134
commit
1c947e50c9
24
docs/faq.txt
24
docs/faq.txt
|
@ -111,8 +111,8 @@ where it makes sense.
|
||||||
<Framework X> does <feature Y> -- why doesn't Django?
|
<Framework X> does <feature Y> -- why doesn't Django?
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
|
|
||||||
We're well aware that there are other awesome web frameworks out there, and
|
We're well aware that there are other awesome Web frameworks out there, and
|
||||||
we're not adverse to borrowing ideas where appropriate. However, Django was
|
we're not adverse to borrowing ideas where appropriate. However, Django was
|
||||||
developed precisely because we were unhappy with the status quo, so please be
|
developed precisely because we were unhappy with the status quo, so please be
|
||||||
aware that "because <Framework X>" does it is not going to be sufficient reason
|
aware that "because <Framework X>" does it is not going to be sufficient reason
|
||||||
to add a given feature to Django.
|
to add a given feature to Django.
|
||||||
|
@ -242,20 +242,20 @@ How do I use image and file fields?
|
||||||
Using a ``FileField`` or an ``ImageField`` in a model takes a few steps:
|
Using a ``FileField`` or an ``ImageField`` in a model takes a few steps:
|
||||||
|
|
||||||
#. In your settings file, define ``MEDIA_ROOT`` as the full path to
|
#. In your settings file, define ``MEDIA_ROOT`` as the full path to
|
||||||
a directory where you'd like Django to store uploaded files (for
|
a directory where you'd like Django to store uploaded files. (For
|
||||||
performance these files are not stored in the database). Define
|
performance, these files are not stored in the database.) Define
|
||||||
``MEDIA_URL`` as the base public URL of that directory. Make
|
``MEDIA_URL`` as the base public URL of that directory. Make sure that
|
||||||
sure that this directory is writable by the web user.
|
this directory is writable by the Web server's user account.
|
||||||
|
|
||||||
#. Add the ``FileField`` or ``ImageField`` to your model, making sure
|
#. Add the ``FileField`` or ``ImageField`` to your model, making sure
|
||||||
to define the ``upload_to`` option to tell Django what subdirectory
|
to define the ``upload_to`` option to tell Django to which subdirectory
|
||||||
of ``MEDIA_ROOT`` to upload files to.
|
of ``MEDIA_ROOT`` it should upload files.
|
||||||
|
|
||||||
#. All that will be stored in your database is a path to the file
|
#. All that will be stored in your database is a path to the file
|
||||||
(relative to ``MEDIA_ROOT``). You'll must likely want to use
|
(relative to ``MEDIA_ROOT``). You'll must likely want to use the
|
||||||
the convenience ``get_<fieldname>_url`` function provided by
|
convenience ``get_<fieldname>_url`` function provided by Django. For
|
||||||
Django (that is, if your ``ImageField`` is called ``mug_shot``,
|
example, if your ``ImageField`` is called ``mug_shot``, you can get the
|
||||||
you can get the absolute URL to your image in a template with
|
absolute URL to your image in a template with
|
||||||
``{{ object.get_mug_shot_url }}``.
|
``{{ object.get_mug_shot_url }}``.
|
||||||
|
|
||||||
The database API
|
The database API
|
||||||
|
|
Loading…
Reference in New Issue