def add_form_errors_as_messages(request, form):
 n_messages = 0
 for (field_name, errors) in form.errors.items():
  if (field_name != NON_FIELD_ERRORS):
   field_label = form[field_name].label
  else:
   field_label = u''
  for error in errors:
   messages.error(request, (u'%s %s' % (field_label, error)))
   n_messages += 1
 return n_messages

def add_form_errors_as_messages ( request , form ) : n_messages = 0 for ( field_name , errors ) in form . errors . items ( ) : if ( field_name != NON_FIELD_ERRORS ) : field_label = form [ field_name ] . label else : field_label = u'' for error in errors : messages . error ( request , ( u'%s %s' % ( field_label , error ) ) ) n_messages += 1 return n_messages
add the forms errors .