1
0
mirror of https://github.com/django/django.git synced 2025-06-05 03:29:12 +00:00

magic-removal: Updated docs to reflect new location of django.utils.httpwrappers

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans 2006-01-11 21:46:50 +00:00
parent 7e3abb4c35
commit 1c989f59d4
6 changed files with 11 additions and 11 deletions

View File

@ -237,7 +237,7 @@ The raw way
The simple, raw way to limit access to pages is to check The simple, raw way to limit access to pages is to check
``request.user.is_anonymous()`` and either redirect to a login page:: ``request.user.is_anonymous()`` and either redirect to a login page::
from django.utils.httpwrappers import HttpResponseRedirect from django.http import HttpResponseRedirect
def my_view(request): def my_view(request):
if request.user.is_anonymous(): if request.user.is_anonymous():

View File

@ -67,7 +67,7 @@ POSTed data from the browser and creates a new ``Place`` object::
from django.core.exceptions import Http404 from django.core.exceptions import Http404
from django.core.extensions import render_to_response from django.core.extensions import render_to_response
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
from django.models.places import places from django.models.places import places
from django.core import formfields from django.core import formfields

View File

@ -30,7 +30,7 @@ and Django's ``HttpResponse`` objects are file-like objects.
Here's an example:: Here's an example::
import csv import csv
from django.utils.httpwrappers import HttpResponse from django.http import HttpResponse
def some_view(request): def some_view(request):
# Create the HttpResponse object with the appropriate CSV header. # Create the HttpResponse object with the appropriate CSV header.
@ -79,7 +79,7 @@ template output the commas in a ``{% for %}`` loop.
Here's an example, which generates the same CSV file as above:: Here's an example, which generates the same CSV file as above::
from django.utils.httpwrappers import HttpResponse from django.http import HttpResponse
from django.core.template import loader, Context from django.core.template import loader, Context
def some_view(request): def some_view(request):

View File

@ -47,7 +47,7 @@ objects.
Here's a "Hello World" example:: Here's a "Hello World" example::
from reportlab.pdfgen import canvas from reportlab.pdfgen import canvas
from django.utils.httpwrappers import HttpResponse from django.http import HttpResponse
def some_view(request): def some_view(request):
# Create the HttpResponse object with the appropriate PDF headers. # Create the HttpResponse object with the appropriate PDF headers.

View File

@ -131,7 +131,7 @@ QueryDict objects
----------------- -----------------
In an ``HttpRequest`` object, the ``GET`` and ``POST`` attributes are instances In an ``HttpRequest`` object, the ``GET`` and ``POST`` attributes are instances
of ``django.utils.httpwrappers.QueryDict``. ``QueryDict`` is a dictionary-like of ``django.http.QueryDict``. ``QueryDict`` is a dictionary-like
class customized to deal with multiple values for the same key. This is class customized to deal with multiple values for the same key. This is
necessary because some HTML form elements, notably ``<select multiple>``, pass necessary because some HTML form elements, notably ``<select multiple>``, pass
multiple values for the same key. multiple values for the same key.
@ -269,7 +269,7 @@ In contrast to ``HttpRequest`` objects, which are created automatically by
Django, ``HttpResponse`` objects are your responsibility. Each view you write Django, ``HttpResponse`` objects are your responsibility. Each view you write
is responsible for instantiating, populating and returning an ``HttpResponse``. is responsible for instantiating, populating and returning an ``HttpResponse``.
The ``HttpResponse`` class lives at ``django.utils.httpwrappers.HttpResponse``. The ``HttpResponse`` class lives at ``django.http.HttpResponse``.
Usage Usage
----- -----
@ -351,7 +351,7 @@ HttpResponse subclasses
Django includes a number of ``HttpResponse`` subclasses that handle different Django includes a number of ``HttpResponse`` subclasses that handle different
types of HTTP responses. Like ``HttpResponse``, these subclasses live in types of HTTP responses. Like ``HttpResponse``, these subclasses live in
``django.utils.httpwrappers``. ``django.http``.
``HttpResponseRedirect`` ``HttpResponseRedirect``
The constructor takes a single argument -- the path to redirect to. This The constructor takes a single argument -- the path to redirect to. This

View File

@ -148,7 +148,7 @@ haven't written any views yet).
Time to write the first view. Open the file ``myproject/polls/views.py`` Time to write the first view. Open the file ``myproject/polls/views.py``
and put the following Python code in it:: and put the following Python code in it::
from django.utils.httpwrappers import HttpResponse from django.http import HttpResponse
def index(request): def index(request):
return HttpResponse("Hello, world. You're at the poll index.") return HttpResponse("Hello, world. You're at the poll index.")
@ -186,7 +186,7 @@ latest 5 poll questions in the system, separated by commas, according to
publication date:: publication date::
from django.models.polls import polls from django.models.polls import polls
from django.utils.httpwrappers import HttpResponse from django.http import HttpResponse
def index(request): def index(request):
latest_poll_list = polls.get_list(order_by=['-pub_date'], limit=5) latest_poll_list = polls.get_list(order_by=['-pub_date'], limit=5)
@ -199,7 +199,7 @@ So let's use Django's template system to separate the design from Python::
from django.core.template import Context, loader from django.core.template import Context, loader
from django.models.polls import polls from django.models.polls import polls
from django.utils.httpwrappers import HttpResponse from django.http import HttpResponse
def index(request): def index(request):
latest_poll_list = polls.get_list(order_by=['-pub_date'], limit=5) latest_poll_list = polls.get_list(order_by=['-pub_date'], limit=5)