Add forms validation to the API.

This PR adds forms validation to the API. The idea is that there's one class which manages the validation of input, and the display of output, if we create a HTML form, for every model. I've made the forms for each of the current models, although the validations are a little sparse right now. 

Sorry for the mis-named branch.