﻿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
25363	Model fields pre_save not called if force_insert=True	David Fischer	David Fischer	"Hello,

We use UUIDs as primary keys.
Because a collision is unlikely to happen, we set the default value of the model's PK field to uuid.uuid4.

But then, we had some issues with Django trying to UPDATE and then INSERT (OK we can understand the logic, but its boring). So we created a small mixin that set the value of force_insert to self._state.adding.

Unfortunately we discovered that the pre_save method of the fields aren't called if insert is forced: https://github.com/django/django/blob/master/django/db/models/base.py#L786.

That's an undocumented and unexpected feature. The documentation specify that the Field's pre_save methods are called on save, and its a save.

Expected: Field.pre_save called unconditionally.
Current: Field.pre_save called at some conditions.
Workaround: Connect to model pre_save signal ..."	Bug	closed	Database layer (models, ORM)	1.8	Normal	needsinfo	pre_save,save		Unreviewed	0	0	0	0	0	0
