Refactored set_elected of assignment to a class based view