Added decorator to produce structured response

@czue 
http://manage.dimagi.com/default.asp?131002
Re-posting this because it got hidden by refactoring:

This will change the response code of errors like `Http404` or `BadRequest`. Maybe we want to use something like [django-jsonview](https://github.com/jsocol/django-jsonview) rather than rolling our own decorator?