summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-09-29 19:36:08 -0400
committerTim Graham <timograham@gmail.com>2015-09-29 19:40:56 -0400
commit00270ec7f8c7c20b3babb97ee807a00588d0a7b7 (patch)
treef8ead3082e80fd64c652c229ffe1f92c594e52f4 /docs/ref
parent59027a4cae8c5abbd0e9308d95dd6608be9199cd (diff)
[1.9.x] Made cosmetic cleanups to docs/ref/contrib/contenttypes.txt
Backport of b47552b445547e60cc89213f79e02333cb63f270 from master
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/contenttypes.txt12
1 files changed, 5 insertions, 7 deletions
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt
index d305039811..539bba961b 100644
--- a/docs/ref/contrib/contenttypes.txt
+++ b/docs/ref/contrib/contenttypes.txt
@@ -103,8 +103,6 @@ created with the following values:
* :attr:`~django.contrib.contenttypes.models.ContentType.model`
will be set to ``'site'``.
-.. _the verbose_name attribute: ../model-api/#verbose_name
-
Methods on ``ContentType`` instances
====================================
@@ -131,8 +129,7 @@ For example, we could look up the
:class:`~django.contrib.auth.models.User` model::
>>> from django.contrib.contenttypes.models import ContentType
- >>> user_type = ContentType.objects.get(app_label="auth", model="user")
- >>> user_type
+ >>> ContentType.objects.get(app_label="auth", model="user")
<ContentType: user>
And then use it to query for a particular
@@ -229,8 +226,7 @@ want to go to the trouble of obtaining the model's metadata to perform a manual
lookup::
>>> from django.contrib.auth.models import User
- >>> user_type = ContentType.objects.get_for_model(User)
- >>> user_type
+ >>> ContentType.objects.get_for_model(User)
<ContentType: user>
.. module:: django.contrib.contenttypes.fields
@@ -374,6 +370,9 @@ Reverse generic relations
If you know which models you'll be using most often, you can also add
a "reverse" generic relationship to enable an additional API. For example::
+ from django.db import models
+ from django.contrib.contenttypes.fields import GenericRelation
+
class Bookmark(models.Model):
url = models.URLField()
tags = GenericRelation(TaggedItem)
@@ -469,7 +468,6 @@ to the queryset to ensure the correct content type, but the
into account. For now, if you need aggregates on generic relations, you'll
need to calculate them without using the aggregation API.
-
.. module:: django.contrib.contenttypes.forms
Generic relation in forms