diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2011-10-12 20:51:59 +0000 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2011-10-12 20:51:59 +0000 |
| commit | f04af7080b12744c8f06fb8228ef683d556690d0 (patch) | |
| tree | ec7d4098b18c1dec978293b08f08df60eecd1ada /docs | |
| parent | a5e691e5de3bededca32ec8d9d997abae5ca81c9 (diff) | |
Introduce `ContentType.objects.get_for_models(*models)` and use it in the the auth permissions code. This is a solid performance gain on the test suite. Thanks to ptone for the profiling to find this hotspot, and carl for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16963 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/contenttypes.txt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt index 914e06115b..fc685c8cd6 100644 --- a/docs/ref/contrib/contenttypes.txt +++ b/docs/ref/contrib/contenttypes.txt @@ -193,6 +193,13 @@ The ``ContentTypeManager`` :class:`~django.contrib.contenttypes.models.ContentType` instance representing that model. + .. method:: get_for_models(*models) + + Takes a variadic number of model classes, and returns a dictionary + mapping the model classes to the + :class:`~django.contrib.contenttypes.models.ContentType` instances + representing them. + .. method:: get_by_natural_key(app_label, model) Returns the :class:`~django.contrib.contenttypes.models.ContentType` @@ -319,8 +326,8 @@ creating a ``TaggedItem``:: Due to the way :class:`~django.contrib.contenttypes.generic.GenericForeignKey` is implemented, you cannot use such fields directly with filters (``filter()`` -and ``exclude()``, for example) via the database API. Because a -:class:`~django.contrib.contenttypes.generic.GenericForeignKey` isn't a +and ``exclude()``, for example) via the database API. Because a +:class:`~django.contrib.contenttypes.generic.GenericForeignKey` isn't a normal field objects, these examples will *not* work:: # This will fail |
