Removed unnecessary code-block directives.

This commit is contained in:
areski 2014-08-18 16:30:44 +02:00 committed by Tim Graham
parent fa02120d36
commit 9d6551204e
32 changed files with 161 additions and 308 deletions

View file

@ -222,9 +222,9 @@ we'll want the functionality provided by
We'll demonstrate this with the ``Author`` model we used in the
:doc:`generic class-based views introduction<generic-display>`.
.. code-block:: python
.. snippet::
:filename: views.py
# views.py
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views.generic import View
@ -253,9 +253,11 @@ look up the author we're interested in, which it just does with a simple call
to ``self.get_object()``. Everything else is taken care of for us by the
mixin.
We can hook this into our URLs easily enough::
We can hook this into our URLs easily enough:
.. snippet::
:filename: urls.py
# urls.py
from django.conf.urls import url
from books.views import RecordInterest
@ -519,9 +521,7 @@ The ``AuthorDisplay`` view is almost the same as :ref:`when we
first introduced AuthorDetail<generic-views-extra-work>`; we have to
write our own ``get_context_data()`` to make the
``AuthorInterestForm`` available to the template. We'll skip the
``get_object()`` override from before for clarity.
.. code-block:: python
``get_object()`` override from before for clarity::
from django.views.generic import DetailView
from django import forms
@ -542,9 +542,7 @@ Then the ``AuthorInterest`` is a simple :class:`FormView`, but we
have to bring in :class:`~django.views.generic.detail.SingleObjectMixin` so we
can find the author we're talking about, and we have to remember to set
``template_name`` to ensure that form errors will render the same
template as ``AuthorDisplay`` is using on ``GET``.
.. code-block:: python
template as ``AuthorDisplay`` is using on ``GET``::
from django.core.urlresolvers import reverse
from django.http import HttpResponseForbidden
@ -573,9 +571,7 @@ based view, so we can do that at the point we choose between the two subviews.
You can of course pass through keyword arguments to
:meth:`~django.views.generic.base.View.as_view()` in the same way you
would in your URLconf, such as if you wanted the ``AuthorInterest`` behavior
to also appear at another URL but using a different template.
.. code-block:: python
to also appear at another URL but using a different template::
from django.views.generic import View