django/django — pull request #3637 by kbr- (2014-11-27 18:34:46+00:00)
Title: Fix a bug in the _create_formsets helper function

The _create_formsets function is a helper function which is used inside
the changeform_view method in several places. To generate formsets,
it first checks if we are inside the add_view method by seeing if obj.pk resolves to True,
that is, seeing if obj was recently created and hasn't had a primary key value
assigned yet. Unfortunately, this is a heuristic and isn't always appropriate.
In particular, this method doesn't give correct results if the primary key value
was explicitly passed inside the model's creation form. The proposed solution
is to pass another parameter to _create_formsets and use it for checking.