middleware to capture doesnot exists exception
middleware to capture exceptions doesnotexists,objectdoesnotexists
- middleware
- django
- exceptions
- objectdoesnotexist
- doesnotexists
middleware to capture exceptions doesnotexists,objectdoesnotexists
A decorator that can be applied to your views to turn ObjectDoesNotExist exceptions into Http404 exceptions. This means people will see a "Page not found" error rather than an "Internal Server Error" when they are request something that does not exist in the database. Example: @raise_404 def show_event(request, id): event = Event.objects.get(id) return render_to_response('events/show_event.html', { 'event' : event })
2 snippets posted so far.