﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22747	Add backwards compatibility tip for new behaviour of formset.save(commit=False)	django@…	nobody	"I just stumbled across the small 'Changed in Django 1.7' message at https://docs.djangoproject.com/en/dev/topics/forms/formsets/#django.forms.formsets.BaseFormSet.can_delete regarding `formset.save(commit=False)`

I have a worry that for people upgrading to 1.7 this might be overlooked. I know it's in the changelog as well, under 'miscellaneous', but should it come under 'backwards incompatible changes' or the such like? Just to make it more obvious.

Although it appears to be a small change, it's quite a big, backwards incompatible one really.

Use Case (untested):

Django Admin ""Mother"" form with ""Child"" formset. I've overridden 
`def save_formset()` say to make sure that each 'Child' formset, when saved, has the correct 'Father' assigned.


{{{
def save_formset(self, request, form, formset, change):
    children = formset.save(commit=False)
    mother = form.save(commit=False)
    for child in children:
         child.father = mother.husband
         child.save()
}}}

As you can see, upgrading to 1.7 any children removed from the admin formset will no longer be deleted from the database. 


My code for 10.7 would look like:

{{{
def save_formset(self, request, form, formset, change):
    children = formset.save(commit=False)
    mother = form.save(commit=False)
    for deleted_child in formset.deleted_objects:
         deleted.delete()
    for child in children:
         # Don't know if this check is required, haven't read the code
         if child in formset.deleted_objects:
              continue
         child.father = mother.husband
         child.save()
}}}

OK, fine. But this code '''is backwards incompatible'''
Try running this code on Django 1.6 and you'll raise [this](https://github.com/django/django/blob/master/django/db/models/base.py#L742) error, because `save(commit=False)` does delete the object from the database, giving the in-memory object a `pk = None`

I've set this as a 'release blocker' since it's easy to fix, and will certainly make life easier for those updating if rectified"	Cleanup/optimization	closed	Documentation	1.7-beta-2	Normal	fixed			Accepted	0	0	0	0	0	0
