Monday, November 3, 2014

Re: How to generally handle exceptions in function based and class based views?

OK, say if I have a function based view then how do I handle the exception?

try:
    context = RequestContext(request)
    context_dict = {}
    ...
    return render_to_response('my_file.html', context_dict, context)
except Exception as e:
    # what to do here?

What about class based views (in form_valid etc)?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a061d856-a2dd-4292-9080-693e59737e61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment