summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2012-05-29 17:55:20 -0400
committerAnssi Kääriäinen <akaariai@gmail.com>2012-06-08 23:07:58 +0300
commitb6d533af4d03f27ea957baa5fd70f7d0b942ef9a (patch)
tree2a43e5b62d58c4de2456d4d5938dceba0a2c1a67 /docs
parent90985048fc1882483794e6734eb91401aefbe768 (diff)
Fixed #18399 – Added a way to get ContentTypes for proxy models
Added kwargs for_concrete_model and for_concrete_models to ContentType methods get_for_model() and get_for_models(). By setting the flag to False, it is possible to get the contenttype for proxy models.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/contenttypes.txt17
-rw-r--r--docs/releases/1.5.txt10
2 files changed, 25 insertions, 2 deletions
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt
index 1181e4b44f..1e9e21a4b7 100644
--- a/docs/ref/contrib/contenttypes.txt
+++ b/docs/ref/contrib/contenttypes.txt
@@ -187,13 +187,13 @@ The ``ContentTypeManager``
probably won't ever need to call this method yourself; Django will call
it automatically when it's needed.
- .. method:: get_for_model(model)
+ .. method:: get_for_model(model[, for_concrete_model=True])
Takes either a model class or an instance of a model, and returns the
:class:`~django.contrib.contenttypes.models.ContentType` instance
representing that model.
- .. method:: get_for_models(*models)
+ .. method:: get_for_models(*models[, for_concrete_models=True])
Takes a variadic number of model classes, and returns a dictionary
mapping the model classes to the
@@ -224,6 +224,19 @@ lookup::
.. _generic-relations:
+.. versionadded:: 1.5
+
+Prior to Django 1.5 :meth:`~ContentTypeManager.get_for_model()` and
+:meth:`~ContentTypeManager.get_for_models()` always returned the
+:class:`~django.contrib.contenttypes.models.ContentType` associated with the
+concrete model of the specified one(s). That means there was no way to retreive
+the :class:`~django.contrib.contenttypes.models.ContentType` of a proxy model
+using those methods. As of Django 1.5 you can now pass a boolean flag –
+respectively ``for_concrete_model`` and ``for_concrete_models`` – to specify
+wether or not you want to retreive the
+:class:`~django.contrib.contenttypes.models.ContentType` for the concrete or
+direct model.
+
Generic relations
=================
diff --git a/docs/releases/1.5.txt b/docs/releases/1.5.txt
index 33f5003281..575bd8d0f8 100644
--- a/docs/releases/1.5.txt
+++ b/docs/releases/1.5.txt
@@ -69,6 +69,16 @@ To make it easier to deal with javascript templates which collide with Django's
syntax, you can now use the :ttag:`verbatim` block tag to avoid parsing the
tag's content.
+Retreival of ``ContentType`` instances associated with proxy models
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The methods :meth:`ContentTypeManager.get_for_model() <django.contrib.contenttypes.models.ContentTypeManager.get_for_model()>`
+and :meth:`ContentTypeManager.get_for_models() <django.contrib.contenttypes.models.ContentTypeManager.get_for_models()>`
+have a new keyword argument – respectively ``for_concrete_model`` and ``for_concrete_models``.
+By passing ``False`` using this argument it is now possible to retreive the
+:class:`ContentType <django.contrib.contenttypes.models.ContentType>`
+associated with proxy models.
+
Minor features
~~~~~~~~~~~~~~