mirror of https://github.com/django/django.git
Fixed #14842 - Indent the model Meta options. Thanks adamv.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15110 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
032aac72c4
commit
9b18b46c0f
|
@ -3,8 +3,8 @@ Model ``Meta`` options
|
||||||
======================
|
======================
|
||||||
|
|
||||||
This document explains all the possible :ref:`metadata options
|
This document explains all the possible :ref:`metadata options
|
||||||
<meta-options>` that you can give your model in its internal ``class
|
<meta-options>` that you can give your model in its internal
|
||||||
Meta``.
|
``class Meta``.
|
||||||
|
|
||||||
Available ``Meta`` options
|
Available ``Meta`` options
|
||||||
==========================
|
==========================
|
||||||
|
@ -16,16 +16,17 @@ Available ``Meta`` options
|
||||||
|
|
||||||
.. attribute:: Options.abstract
|
.. attribute:: Options.abstract
|
||||||
|
|
||||||
If ``True``, this model will be an :ref:`abstract base class <abstract-base-classes>`.
|
If ``abstract = True``, this model will be an
|
||||||
|
:ref:`abstract base class <abstract-base-classes>`.
|
||||||
|
|
||||||
``app_label``
|
``app_label``
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
.. attribute:: Options.app_label
|
.. attribute:: Options.app_label
|
||||||
|
|
||||||
If a model exists outside of the standard :file:`models.py` (for instance, if
|
If a model exists outside of the standard :file:`models.py` (for instance,
|
||||||
the app's models are in submodules of ``myapp.models``), the model must define
|
if the app's models are in submodules of ``myapp.models``), the model must
|
||||||
which app it is part of::
|
define which app it is part of::
|
||||||
|
|
||||||
app_label = 'myapp'
|
app_label = 'myapp'
|
||||||
|
|
||||||
|
@ -46,8 +47,8 @@ Table names
|
||||||
To save you time, Django automatically derives the name of the database table
|
To save you time, Django automatically derives the name of the database table
|
||||||
from the name of your model class and the app that contains it. A model's
|
from the name of your model class and the app that contains it. A model's
|
||||||
database table name is constructed by joining the model's "app label" -- the
|
database table name is constructed by joining the model's "app label" -- the
|
||||||
name you used in ``manage.py startapp`` -- to the model's class name, with an
|
name you used in :djadmin:`manage.py startapp <startapp>` -- to the model's
|
||||||
underscore between them.
|
class name, with an underscore between them.
|
||||||
|
|
||||||
For example, if you have an app ``bookstore`` (as created by
|
For example, if you have an app ``bookstore`` (as created by
|
||||||
``manage.py startapp bookstore``), a model defined as ``class Book`` will have
|
``manage.py startapp bookstore``), a model defined as ``class Book`` will have
|
||||||
|
@ -65,16 +66,16 @@ Django quotes column and table names behind the scenes.
|
||||||
|
|
||||||
.. attribute:: Options.db_tablespace
|
.. attribute:: Options.db_tablespace
|
||||||
|
|
||||||
The name of the database tablespace to use for the model. If the backend doesn't
|
The name of the database tablespace to use for the model. If the backend
|
||||||
support tablespaces, this option is ignored.
|
doesn't support tablespaces, this option is ignored.
|
||||||
|
|
||||||
``get_latest_by``
|
``get_latest_by``
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
.. attribute:: Options.get_latest_by
|
.. attribute:: Options.get_latest_by
|
||||||
|
|
||||||
The name of a :class:`DateField` or :class:`DateTimeField` in the model. This
|
The name of a :class:`DateField` or :class:`DateTimeField` in the model.
|
||||||
specifies the default field to use in your model :class:`Manager`'s
|
This specifies the default field to use in your model :class:`Manager`'s
|
||||||
:class:`~QuerySet.latest` method.
|
:class:`~QuerySet.latest` method.
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
@ -84,7 +85,7 @@ Example::
|
||||||
See the docs for :meth:`~django.db.models.QuerySet.latest` for more.
|
See the docs for :meth:`~django.db.models.QuerySet.latest` for more.
|
||||||
|
|
||||||
``managed``
|
``managed``
|
||||||
-----------------------
|
-----------
|
||||||
|
|
||||||
.. attribute:: Options.managed
|
.. attribute:: Options.managed
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ management command. That is, Django *manages* the database tables' lifecycles.
|
||||||
If ``False``, no database table creation or deletion operations will be
|
If ``False``, no database table creation or deletion operations will be
|
||||||
performed for this model. This is useful if the model represents an existing
|
performed for this model. This is useful if the model represents an existing
|
||||||
table or a database view that has been created by some other means. This is
|
table or a database view that has been created by some other means. This is
|
||||||
the *only* difference when ``managed`` is ``False``. All other aspects of
|
the *only* difference when ``managed=False``. All other aspects of
|
||||||
model handling are exactly the same as normal. This includes
|
model handling are exactly the same as normal. This includes
|
||||||
|
|
||||||
1. Adding an automatic primary key field to the model if you don't declare
|
1. Adding an automatic primary key field to the model if you don't declare
|
||||||
|
@ -215,7 +216,7 @@ human_readable_permission_name)``.
|
||||||
|
|
||||||
.. attribute:: Options.proxy
|
.. attribute:: Options.proxy
|
||||||
|
|
||||||
If set to ``True``, a model which subclasses another model will be treated as
|
If ``proxy = True``, a model which subclasses another model will be treated as
|
||||||
a :ref:`proxy model <proxy-models>`.
|
a :ref:`proxy model <proxy-models>`.
|
||||||
|
|
||||||
``unique_together``
|
``unique_together``
|
||||||
|
|
Loading…
Reference in New Issue