def save_instance(form, instance, fields=None, fail_message=u'saved', commit=True, exclude=None, construct=True):
 if construct:
  instance = construct_instance(form, instance, fields, exclude)
 opts = instance._meta
 if form.errors:
  raise ValueError((u"The %s could not be %s because the data didn't validate." % (opts.object_name, fail_message)))
 def save_m2m():
  cleaned_data = form.cleaned_data
  for f in opts.many_to_many:
   if (fields and (f.name not in fields)):
    continue
   if (f.name in cleaned_data):
    f.save_form_data(instance, cleaned_data[f.name])
 if commit:
  instance.save()
  save_m2m()
 else:
  form.save_m2m = save_m2m
 return instance

def save_instance ( form , instance , fields = None , fail_message = u'saved' , commit = True , exclude = None , construct = True ) : if construct : instance = construct_instance ( form , instance , fields , exclude ) opts = instance . _meta if form . errors : raise ValueError ( ( u"The %s could not be %s because the data didn't validate." % ( opts . object_name , fail_message ) ) ) def save_m2m ( ) : cleaned_data = form . cleaned_data for f in opts . many_to_many : if ( fields and ( f . name not in fields ) ) : continue if ( f . name in cleaned_data ) : f . save_form_data ( instance , cleaned_data [ f . name ] ) if commit : instance . save ( ) save_m2m ( ) else : form . save_m2m = save_m2m return instance
saves bound form forms cleaned_data into model instance instance .