Cache computation of flat topic tree and Django response

Partially addresses #823:
* Only compute "flat topic tree" once
* Let the browser cache the 1.1MB response

Still to be done:
* Find a way to get the browser to avoid recomputing the dictionary from the json string

@aronasorman could you take a look?