Make template json output useful for imjs.

We were not serialising all constraints, just editable ones. The way
imjs works means this is fairly pointless as it doesn't even use the
template query endpoints (and there is no benefit in doing so anyway).
This change means that imjs can natively consume available templates
listings now.
Fix user error being swallowed as HTTP 500.

addView throws IllegalArgumentException if the views are badly
formatted. This should be caught as user error.