mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Used consistent capitalization and hyphenation of "class-based views" in docs.
This commit is contained in:
parent
39b55537ec
commit
20787b5c29
11 changed files with 14 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
|||
.. _Generic views:
|
||||
|
||||
==================================
|
||||
Built-in Class-based generic views
|
||||
Built-in class-based generic views
|
||||
==================================
|
||||
|
||||
Writing Web applications can be monotonous, because we repeat certain patterns
|
||||
|
|
|
@ -84,7 +84,7 @@ views::
|
|||
|
||||
|
||||
For more information on how to use the built in generic views, consult the next
|
||||
topic on :doc:`generic class based views</topics/class-based-views/generic-display>`.
|
||||
topic on :doc:`generic class-based views</topics/class-based-views/generic-display>`.
|
||||
|
||||
.. _supporting-other-http-methods:
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
=================================
|
||||
Introduction to Class-based views
|
||||
Introduction to class-based views
|
||||
=================================
|
||||
|
||||
Class-based views provide an alternative way to implement views as Python
|
||||
|
@ -43,7 +43,7 @@ The toolkit of base classes and mixins that Django uses to build class-based
|
|||
generic views are built for maximum flexibility, and as such have many hooks in
|
||||
the form of default method implementations and attributes that you are unlikely
|
||||
to be concerned with in the simplest use cases. For example, instead of
|
||||
limiting you to a class based attribute for ``form_class``, the implementation
|
||||
limiting you to a class-based attribute for ``form_class``, the implementation
|
||||
uses a ``get_form`` method, which calls a ``get_form_class`` method, which in
|
||||
its default implementation just returns the ``form_class`` attribute of the
|
||||
class. This gives you several options for specifying what form to use, from a
|
||||
|
|
|
@ -204,11 +204,10 @@ the box.
|
|||
understandable to someone else coming to it later, and with fewer
|
||||
interactions to worry about you will save yourself some thinking. (Of
|
||||
course, you can always dip into Django's implementation of the generic
|
||||
class based views for inspiration on how to tackle problems.)
|
||||
class-based views for inspiration on how to tackle problems.)
|
||||
|
||||
.. _method resolution order: https://www.python.org/download/releases/2.3/mro/
|
||||
|
||||
|
||||
Using SingleObjectMixin with View
|
||||
---------------------------------
|
||||
|
||||
|
@ -593,7 +592,7 @@ views as separate as possible.
|
|||
More than just HTML
|
||||
===================
|
||||
|
||||
Where class based views shine is when you want to do the same thing many times.
|
||||
Where class-based views shine is when you want to do the same thing many times.
|
||||
Suppose you're writing an API, and every view should return JSON instead of
|
||||
rendered HTML.
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ algorithm the system follows to determine which Python code to execute:
|
|||
one that matches the requested URL.
|
||||
|
||||
4. Once one of the regexes matches, Django imports and calls the given view,
|
||||
which is a simple Python function (or a :doc:`class based view
|
||||
which is a simple Python function (or a :doc:`class-based view
|
||||
</topics/class-based-views/index>`). The view gets passed the following
|
||||
arguments:
|
||||
|
||||
|
|
|
@ -506,7 +506,7 @@ Specifically, a ``Response`` object has the following attributes:
|
|||
# my_view here is a function based view
|
||||
self.assertEqual(response.resolver_match.func, my_view)
|
||||
|
||||
# class based views need to be compared by name, as the functions
|
||||
# class-based views need to be compared by name, as the functions
|
||||
# generated by as_view() won't be equal
|
||||
self.assertEqual(response.resolver_match.func.__name__, MyView.as_view().__name__)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue