﻿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
35890	pre_save field in parent models are not called during update in update_or_create	Gagaro	Jericho Serrano	"With the following models:

{{{
class Parent(models.Model):
    modified_at = models.DateTimeField(auto_now=True)


class Child(Parent):
    modified_at_child = models.DateTimeField(auto_now=True)
}}}

When calling `update_or_create`, the pre_save of the `modified_at` field is not called, and the field is not updated:


{{{
# Create

>>> instance, _ = Child.objects.update_or_create(pk=1)
>>> instance.modified_at
datetime.datetime(2024, 11, 6, 14, 1, 11, 52881, tzinfo=datetime.timezone.utc)
>>> instance.modified_at_child
datetime.datetime(2024, 11, 6, 14, 1, 11, 54363, tzinfo=datetime.timezone.utc)


# Update

>>> instance, _ = Child.objects.update_or_create(pk=1)
>>> instance.modified_at
datetime.datetime(2024, 11, 6, 14, 1, 11, 52881, tzinfo=datetime.timezone.utc)
>>> instance.modified_at_child
datetime.datetime(2024, 11, 6, 14, 1, 21, 517245, tzinfo=datetime.timezone.utc)
}}}


The regression seems to have happened in https://github.com/django/django/commit/6cc0f22a73970dd7c0d29d4d8d2ff9e1cc862b30

Using `self.model._meta.concrete_fields` instead of `self.model._meta.local_concrete_fields` seems to solve the issue, but I don't know the internal API well enough to understand all of the implications.

PR : https://github.com/django/django/pull/18777"	Bug	assigned	Database layer (models, ORM)	dev	Normal			Gagaro Simon Charette Florian Apolloner Sarah Boyce Clifford Gama	Accepted	1	0	0	0	0	0
