Ticket #3263: newforms_models.diff
File newforms_models.diff, 768 bytes (added by , 18 years ago) |
---|
-
newforms/models.py
33 33 if form.errors: 34 34 raise ValueError("The %s could not be changed because the data didn't validate." % opts.object_name) 35 35 clean_data = form.clean_data 36 for f in opts.fields + opts.many_to_many:36 for f in opts.fields: 37 37 if isinstance(f, models.AutoField): 38 38 continue 39 39 setattr(instance, f.attname, clean_data[f.name]) 40 for f in opts.many_to_many: 41 setattr(instance, f.attname, getattr(instance, f.attname).model.objects.filter(pk__in = clean_data[f.name])) 40 42 if commit: 41 43 instance.save() 42 44 return instance