Fixed 2 errors introduced in 7c8b73f228.
Fixed PEP8 errors and separated logic of forms.
Made entities list selector a form.