More validity logic

Added validated & some fixes.

Also: moved pending documents logic from view to
DocumentSet: get_pending_documents
Fix redirect

Removed redirect from form_detail that prevented success in client side
$.post.

Also: moved pending documents logic to model.