refactor backend for details

* split into two DetailPair, each with short and long
* lazy migration for old format
* fix all references to details/get_detail/get_details
fix detail screen js to accept new format

* simplify by removing referals UI
  ! 1.0 apps will no longer have that section available
* clean up some things found along the way
  - fix doubly serialized JSON
Merge pull request #1778 from dimagi/refactor-case-details

Refactor case details