diff options
| author | rowanv <rrvspam@gmail.com> | 2016-01-24 22:26:11 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-02-01 10:42:05 -0500 |
| commit | a6ef025dfb2a1d1bd23893408eef6d066fb506d9 (patch) | |
| tree | b29b3624a20cc65184c743102e0f5f620412105f /docs/topics/class-based-views | |
| parent | 8bf8d0e0ecc1805480deb94feb4675b09d3b3a95 (diff) | |
Fixed #26124 -- Added missing code formatting to docs headers.
Diffstat (limited to 'docs/topics/class-based-views')
| -rw-r--r-- | docs/topics/class-based-views/generic-editing.txt | 8 | ||||
| -rw-r--r-- | docs/topics/class-based-views/mixins.txt | 20 |
2 files changed, 14 insertions, 14 deletions
diff --git a/docs/topics/class-based-views/generic-editing.txt b/docs/topics/class-based-views/generic-editing.txt index 0a1cd06961..6cc83ef563 100644 --- a/docs/topics/class-based-views/generic-editing.txt +++ b/docs/topics/class-based-views/generic-editing.txt @@ -13,7 +13,7 @@ Implementing this yourself often results in a lot of repeated boilerplate code this, Django provides a collection of generic class-based views for form processing. -Basic Forms +Basic forms =========== Given a simple contact form: @@ -60,7 +60,7 @@ Notes: :meth:`~django.views.generic.edit.FormMixin.form_valid` simply redirects to the :attr:`~django.views.generic.edit.FormMixin.success_url`. -Model Forms +Model forms =========== Generic views really shine when working with models. These generic @@ -180,8 +180,8 @@ Finally, we hook these new views into the URLconf: :attr:`~django.views.generic.detail.SingleObjectTemplateResponseMixin.template_name_suffix` on your view class. -Models and request.user -======================= +Models and ``request.user`` +=========================== To track the user that created an object using a :class:`CreateView`, you can use a custom :class:`~django.forms.ModelForm` to do this. First, add diff --git a/docs/topics/class-based-views/mixins.txt b/docs/topics/class-based-views/mixins.txt index 07b2eda2bc..e53a8599e4 100644 --- a/docs/topics/class-based-views/mixins.txt +++ b/docs/topics/class-based-views/mixins.txt @@ -86,8 +86,8 @@ date-based generic views. These are covered in the :doc:`mixin reference documentation</ref/class-based-views/mixins>`. -DetailView: working with a single Django object ------------------------------------------------ +``DetailView``: working with a single Django object +--------------------------------------------------- To show the detail of an object, we basically need to do two things: we need to look up the object and then we need to make a @@ -124,8 +124,8 @@ on a subclass to something else. (For instance, the :doc:`generic edit views<generic-editing>` use ``_form`` for create and update views, and ``_confirm_delete`` for delete views.) -ListView: working with many Django objects ------------------------------------------- +``ListView``: working with many Django objects +---------------------------------------------- Lists of objects follow roughly the same pattern: we need a (possibly paginated) list of objects, typically a @@ -208,8 +208,8 @@ the box. .. _method resolution order: https://www.python.org/download/releases/2.3/mro/ -Using SingleObjectMixin with View ---------------------------------- +Using ``SingleObjectMixin`` with View +------------------------------------- If we want to write a simple class-based view that responds only to ``POST``, we'll subclass :class:`~django.views.generic.base.View` and @@ -271,8 +271,8 @@ to look up the ``Author`` instance. You could also use a slug, or any of the other features of :class:`~django.views.generic.detail.SingleObjectMixin`. -Using SingleObjectMixin with ListView -------------------------------------- +Using ``SingleObjectMixin`` with ``ListView`` +--------------------------------------------- :class:`~django.views.generic.list.ListView` provides built-in pagination, but you might want to paginate a list of objects that are @@ -404,8 +404,8 @@ is a simpler solution. First, let's look at a naive attempt to combine ``POST`` a Django :class:`~django.forms.Form` to the same URL as we're displaying an object using :class:`DetailView`. -Using FormMixin with DetailView -------------------------------- +Using ``FormMixin`` with ``DetailView`` +--------------------------------------- Think back to our earlier example of using :class:`View` and :class:`~django.views.generic.detail.SingleObjectMixin` together. We were |
