diff --git a/django/core/meta/__init__.py b/django/core/meta/__init__.py index 9d807ed892..02e264607b 100644 --- a/django/core/meta/__init__.py +++ b/django/core/meta/__init__.py @@ -1456,7 +1456,7 @@ def manipulator_save(opts, klass, add, change, self, new_data): params[f.column] = f.get_manipulator_new_data(new_data) if change: - params[opts.pk.name] = self.obj_key + params[opts.pk.column] = self.obj_key # First, save the basic object itself. new_object = klass(**params) diff --git a/django/views/admin/main.py b/django/views/admin/main.py index 738dd15cea..17bfa12d8b 100644 --- a/django/views/admin/main.py +++ b/django/views/admin/main.py @@ -876,7 +876,7 @@ def change_stage(request, app_label, module_name, object_id): new_data.setlist(f.name, new_data[f.name].split(",")) manipulator.do_html2python(new_data) new_object = manipulator.save(new_data) - pk_value = getattr(new_object, opts.pk.name) + pk_value = getattr(new_object, opts.pk.column) # Construct the change message. change_message = []