From 69ddc1b3da043195a0f4e09211d395724b42c70b Mon Sep 17 00:00:00 2001 From: Luis Del Giudice Date: Sun, 26 Apr 2015 17:05:50 -0400 Subject: Fixed #24693 -- Added label and label_lower property to Model._meta --- docs/ref/models/options.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'docs/ref/models') 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'``. -- cgit v1.3