A model of voting with motivated beliefs