[BUG] Data row duplication while changing inherited models using oldforms manipulators
|Reported by:||m.gajda@…||Owned by:||nobody|
|Severity:||Keywords:||bug oldforms row duplication change|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
I've discovered using admin application, that while trying to save some existing object, which model class inherits from other model class, a new rows are added to database instead of changing the existing ones.
The problem is save method of the django.db.models.manipulators.AutomaticManipulator class, which does not set primary key values for super class models, which should be later processed by model's save method.
The attached patch tries to solve this bug by setting primary key values on all super models while preparing data to save in manipulator class. It works for me, but I did not run test suites to check the behaviour in all cases.