Test shutoff

Adds custom authorization for testlog tastypie endpoint to ensure that students cannot record answers after a test has been deactivated. Teachers are still able to do so.

The resulting error message is poorly rendered on the client side - we need a general way to parse Tastypie Unauthorized messages well on the client. Would also be good to enforce a redirect as a result.

I can try to look at this in the near future, but wanted to get something shippable in first.

@aronasorman @jamalex Please take a quick look. Tests written for the functionality pass.
Does the same. https://wiki.python.org/moin/HandlingExceptions - again, copied from gist above.