Fixed #601 -- Updated docs/model-api.txt unique_together section to say it's enforced at the database level.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@822 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b4e2d12b1f
commit
474cfe56d4
|
@ -248,18 +248,18 @@ Here are all available field types:
|
|||
uploaded files don't fill up the given directory).
|
||||
|
||||
The admin represents this as an ``<input type="file">`` (a file-upload widget).
|
||||
|
||||
Using a `FieldField` or an ``ImageField`` (see below) in a model takes a few
|
||||
|
||||
Using a `FieldField` or an ``ImageField`` (see below) in a model takes a few
|
||||
steps:
|
||||
|
||||
|
||||
1. In your settings file, you'll need to 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 server's user
|
||||
account.
|
||||
|
||||
2. Add the ``FileField`` or ``ImageField`` to your model, making sure
|
||||
|
||||
2. Add the ``FileField`` or ``ImageField`` to your model, making sure
|
||||
to define the ``upload_to`` option to tell Django to which
|
||||
subdirectory of ``MEDIA_ROOT`` it should upload files.
|
||||
|
||||
|
@ -269,7 +269,7 @@ Here are all available field types:
|
|||
example, 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 }}``.
|
||||
|
||||
|
||||
.. _`strftime formatting`: http://docs.python.org/lib/module-time.html#l2h-1941
|
||||
|
||||
``FloatField``
|
||||
|
@ -302,7 +302,7 @@ Here are all available field types:
|
|||
width of the image each time a model instance is saved.
|
||||
|
||||
Requires the `Python Imaging Library`_.
|
||||
|
||||
|
||||
.. _Python Imaging Library: http://www.pythonware.com/products/pil/
|
||||
|
||||
``IntegerField``
|
||||
|
@ -721,7 +721,9 @@ Here's a list of all possible ``META`` options. No options are required. Adding
|
|||
unique_together = (("driver", "restaurant"),)
|
||||
|
||||
This is a list of lists of fields that must be unique when considered
|
||||
together. It's used in the Django admin.
|
||||
together. It's used in the Django admin and is enforced at the database
|
||||
level (i.e., the appropriate ``UNIQUE`` statements are included in the
|
||||
``CREATE TABLE`` statement).
|
||||
|
||||
``verbose_name``
|
||||
A human-readable name for the object, singular::
|
||||
|
|
Loading…
Reference in New Issue