summaryrefslogtreecommitdiff
path: root/docs/ref/models/options.txt
diff options
context:
space:
mode:
authorLuis Del Giudice <luis.dg19@gmail.com>2015-04-26 17:05:50 -0400
committerMarkus Holtermann <info@markusholtermann.eu>2015-05-02 16:58:18 +0200
commit69ddc1b3da043195a0f4e09211d395724b42c70b (patch)
tree110548448fb30ecdc9102d0f3a0a1c1dfc946646 /docs/ref/models/options.txt
parent811d7870a5c7e419a3f041e04a7432d6f28016f8 (diff)
Fixed #24693 -- Added label and label_lower property to Model._meta
Diffstat (limited to 'docs/ref/models/options.txt')
-rw-r--r--docs/ref/models/options.txt29
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt
index f9a17721cf..1dff215888 100644
--- a/docs/ref/models/options.txt
+++ b/docs/ref/models/options.txt
@@ -29,6 +29,12 @@ Available ``Meta`` options
app_label = 'myapp'
+ .. versionadded:: 1.9
+
+ If you want to represent a model with the format ``app_label.object_name``
+ or ``app_label.model_name`` you can use ``model._meta.label``
+ or ``model._meta.label_lower`` respectively.
+
``db_table``
------------
@@ -397,3 +403,26 @@ Django quotes column and table names behind the scenes.
verbose_name_plural = "stories"
If this isn't given, Django will use :attr:`~Options.verbose_name` + ``"s"``.
+
+Read-only ``Meta`` attributes
+=============================
+
+``label``
+---------
+
+.. attribute:: Options.label
+
+ .. versionadded:: 1.9
+
+ Representation of the object, returns ``app_label.object_name``, e.g.
+ ``'polls.Question'``.
+
+``label_lower``
+---------------
+
+.. attribute:: Options.label_lower
+
+ .. versionadded:: 1.9
+
+ Representation of the model, returns ``app_label.model_name``, e.g.
+ ``'polls.question'``.