On Mar 1, 12:53 pm, "Honza Král" <[EMAIL PROTECTED]> wrote:
> > 1. Is there an easy way to get the new object created by form.save()? > > obj = form.save() Thanks, I finally saw that after perusing the django source code. > > 2. Is is true that one should not call form.save() if the form was > > instantiated from a class resulting from form_for_instance()? > > no, this is not true, if it were the case, why would the method be there? I agree with you; however, I was referencing the user "chasfs" who commented in: (http://groups.google.com/group/django-users/browse_frm/thread/ cbbf169b6aaa3f39/3f08ba5b59feea3d?lnk=st&q=form_for_instance +form.save&rnum=6#3f08ba5b59feea3d) writing: "and finally, if you are using form_for_instance, to update an existing instance, you can't use the form.save - instead try something like this: form = forms.form_for_instance(obj, formfield_callback=obj_callback) (request.POST) if form.is_valid(): for i in form.clean_data: obj.__setattr__(i, form.clean_data[i]) obj.save() return HttpResponseRedirect(...)" Thanks for your assistance Honza! Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---