mirror of
https://github.com/django/django.git
synced 2025-04-17 22:04:38 +00:00
magic-removal: Updated docs to reflect new location of django.exceptions.Http404
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
7ff20316f0
commit
c4b139eabd
@ -65,9 +65,8 @@ Using the ``AddManipulator``
|
||||
We'll start with the ``AddManipulator``. Here's a very simple view that takes
|
||||
POSTed data from the browser and creates a new ``Place`` object::
|
||||
|
||||
from django.core.exceptions import Http404
|
||||
from django.core.extensions import render_to_response
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
||||
from django.models.places import places
|
||||
from django.core import formfields
|
||||
|
||||
|
@ -274,7 +274,7 @@ Raising 404
|
||||
Now, let's tackle the poll detail view -- the page that displays the question
|
||||
for a given poll. Here's the view::
|
||||
|
||||
from django.core.exceptions import Http404
|
||||
from django.http import Http404
|
||||
def detail(request, poll_id):
|
||||
try:
|
||||
p = polls.get_object(pk=poll_id)
|
||||
@ -282,7 +282,7 @@ for a given poll. Here's the view::
|
||||
raise Http404
|
||||
return render_to_response('polls/detail', {'poll': p})
|
||||
|
||||
The new concept here: The view raises the ``django.core.exceptions.Http404``
|
||||
The new concept here: The view raises the ``django.http.Http404``
|
||||
exception if a poll with the requested ID doesn't exist.
|
||||
|
||||
A shortcut: get_object_or_404()
|
||||
|
Loading…
x
Reference in New Issue
Block a user