Reputation: 3797
What is the difference between Django's two options:
return HttpRequestNotFound()
raise Http404
?
Upvotes: 1
Views: 109
Reputation: 122326
HttpRequestNotFound
means that the view takes care of presenting the 404 page and its HTML. You can use this if you want a view to present a different 404 error page than the default Django 404 page.Http404
means Django will use the default 404 view that you've configured (by default this is django.views.defaults.page_not_found
). This can be modified by specifying a different handler for 404 pages (see django.conf.urls.handler404
).For more details see Django's documentation on 404 error pages.
Upvotes: 1