diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2005-07-24 19:02:22 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2005-07-24 19:02:22 +0000 |
| commit | 8bd30b01e401e7ed8ef87bf42bec2614e8d96570 (patch) | |
| tree | f0f1fafe75bd0438d3e5ab656dc335cdc343929c /docs/faq.txt | |
| parent | 768c17eda0310b99daa75e05e7e1e00bb82fbc15 (diff) | |
Added formfields/manipulators docs; added a few notes to the FAQ
git-svn-id: http://code.djangoproject.com/svn/django/trunk@303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/faq.txt')
| -rw-r--r-- | docs/faq.txt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/faq.txt b/docs/faq.txt index 097f22ed4f..717edfa779 100644 --- a/docs/faq.txt +++ b/docs/faq.txt @@ -101,10 +101,22 @@ any capital-M Methodologies; we do what "feels" right. If you squint the right way, you can call Django's ORM the "Model", the view functions the "View", and the dynamically-generated API the "Controller" -- but not really. +In fact, you might say that Django is a "MTV" framework -- that is, Model, +Template, and View make much more sense to us. + So, although we've been strongly influenced by MVC -- especially in the separation-of-data-from-logic department -- we've also strayed from the path where it makes sense. +<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 not adverse to borrowing ideas where appropriate. However, Django was +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 +to add a given feature to Django. + Do you have any of those nifty "screencast" things? --------------------------------------------------- @@ -224,6 +236,28 @@ but we recognize that choosing a template language runs close to religion. There's nothing about Django that requires using the template language, so if you're attached to ZPT, Cheetah, or whatever, feel free to use those. +How do I use image and file fields? +----------------------------------- + +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 + a directory where you'd like Django to store uploaded files (for + performance these files are not stored in the database). Define + ``MEDIA_URL`` as the base public URL of that directory. Make + sure that this directory is writable by the web user. + + #. Add the ``FileField`` or ``ImageField`` to your model, making sure + to define the ``upload_to`` option to tell Django what subdirectory + of ``MEDIA_ROOT`` to upload files to. + + #. 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 + the convenience ``get_<fieldname>_url`` function provided by + Django (that is, if your ``ImageField`` is called ``mug_shot``, + you can get the absolute URL to your image in a template with + ``{{ object.get_mug_shot_url }}``. + The database API ================ |
