Solved copy-paste code in views.py by moving common parts to utils
Fixed initialization values (avoid potential vulnerability of querying any object)