Flash all form error messages

def flash_errors(form, category='warning'):
    """ Flash all form error messages """

    for (field, errors) in form.errors.items():
        for error in errors:
            flash('{0} - {1}'.format(getattr(form, field).label.text, error),
                  category)