Generate a form from a model