Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.3.X] Fixed #16021 - Minor documentation fixes for Generic Class Vi…

…ews; thanks Bradley Ayers.

Backport of r16256 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@16257 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 08f5ac3d51c2e4b9ddf28a1bae640c1970decd8c 1 parent b5c6b4f
Tim Graham authored May 22, 2011
12  docs/ref/class-based-views.txt
@@ -81,20 +81,20 @@ TemplateResponseMixin
81 81
         The response class to be returned by ``render_to_response`` method.
82 82
         Default is
83 83
         :class:`TemplateResponse <django.template.response.TemplateResponse>`.
84  
-        The template and context of TemplateResponse instances can be
  84
+        The template and context of ``TemplateResponse`` instances can be
85 85
         altered later (e.g. in
86 86
         :ref:`template response middleware <template-response-middleware>`).
87 87
 
88  
-        Create TemplateResponse subclass and pass set it to
89  
-        ``template_response_class`` if you need custom template loading or
90  
-        custom context object instantiation.
  88
+        If you need custom template loading or custom context object
  89
+        instantiation, create a ``TemplateResponse`` subclass and assign it to
  90
+        ``response_class``.
91 91
 
92 92
     .. method:: render_to_response(context, **response_kwargs)
93 93
 
94  
-        Returns a ``self.template_response_class`` instance.
  94
+        Returns a ``self.response_class`` instance.
95 95
 
96 96
         If any keyword arguments are provided, they will be
97  
-        passed to the constructor of the response instance.
  97
+        passed to the constructor of the response class.
98 98
 
99 99
         Calls :meth:`~TemplateResponseMixin.get_template_names()` to obtain the
100 100
         list of template names that will be searched looking for an existent
20  docs/topics/class-based-views.txt
@@ -71,7 +71,7 @@ so we can just subclass it, and override the template name::
71 71
         template_name = "about.html"
72 72
 
73 73
 Then, we just need to add this new view into our URLconf. As the class-based
74  
-views themselves are classes, we point the URL to the as_view class method
  74
+views themselves are classes, we point the URL to the ``as_view`` class method
75 75
 instead, which is the entry point for class-based views::
76 76
 
77 77
     # urls.py
@@ -83,7 +83,7 @@ instead, which is the entry point for class-based views::
83 83
     )
84 84
 
85 85
 Alternatively, if you're only changing a few simple attributes on a
86  
-class-based view, you can simply pass the new attributes into the as_view
  86
+class-based view, you can simply pass the new attributes into the ``as_view``
87 87
 method call itself::
88 88
 
89 89
     from django.conf.urls.defaults import *
@@ -121,12 +121,12 @@ be using these models::
121 121
         country = models.CharField(max_length=50)
122 122
         website = models.URLField()
123 123
 
124  
-        def __unicode__(self):
125  
-            return self.name
126  
-
127 124
         class Meta:
128 125
             ordering = ["-name"]
129 126
 
  127
+        def __unicode__(self):
  128
+            return self.name
  129
+
130 130
     class Book(models.Model):
131 131
         title = models.CharField(max_length=100)
132 132
         authors = models.ManyToManyField('Author')
@@ -211,7 +211,7 @@ all the publishers in a variable named ``object_list``. While this
211 211
 works just fine, it isn't all that "friendly" to template authors:
212 212
 they have to "just know" that they're dealing with publishers here.
213 213
 
214  
-Well, if you're dealing with a Django object, this is already done for
  214
+Well, if you're dealing with a model object, this is already done for
215 215
 you. When you are dealing with an object or queryset, Django is able
216 216
 to populate the context using the verbose name (or the plural verbose
217 217
 name, in the case of a list of objects) of the object being displayed.
@@ -353,7 +353,7 @@ key in the URL. Earlier we hard-coded the publisher's name in the URLconf, but
353 353
 what if we wanted to write a view that displayed all the books by some arbitrary
354 354
 publisher?
355 355
 
356  
-Handily, the ListView has a
  356
+Handily, the ``ListView`` has a
357 357
 :meth:`~django.views.generic.detail.ListView.get_queryset` method we can
358 358
 override. Previously, it has just been returning the value of the ``queryset``
359 359
 attribute, but now we can add more logic.
@@ -444,8 +444,8 @@ custom view:
444 444
         **(r'^authors/(?P<pk>\\d+)/$', AuthorDetailView.as_view()),**
445 445
     )
446 446
 
447  
-Then we'd write our new view - ``get_object`` is the method that retrieves the
448  
-object, so we simply override it and wrap the call::
  447
+Then we'd write our new view -- ``get_object`` is the method that retrieves the
  448
+object -- so we simply override it and wrap the call::
449 449
 
450 450
     import datetime
451 451
     from books.models import Author
@@ -473,7 +473,7 @@ object, so we simply override it and wrap the call::
473 473
 .. note::
474 474
 
475 475
     The URLconf here uses the named group ``pk`` - this name is the default
476  
-    name that DetailView uses to find the value of the primary key used to
  476
+    name that ``DetailView`` uses to find the value of the primary key used to
477 477
     filter the queryset.
478 478
 
479 479
     If you want to change it, you'll need to do your own ``get()`` call

0 notes on commit 08f5ac3

Please sign in to comment.
Something went wrong with that request. Please try again.