Updated code to handle new wtforms syntax