﻿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
19396	Allow customized ModelState classes	Anssi Kääriäinen	nobody	"By allowing classes to define customized ModelState classes and by introducing some hooks into model saving custom Model subclasses can implement some often requested things:
  - Automatic primary key updates
  - Save only changed data
  - Proper optimistic locking

Two of the above ideas are implemented in the added tests in https://github.com/akaariai/django/compare/akaariai:model_save_refactor...akaariai:model_state_improvements. The patch is based on model_save_refactor from #16649.

The cost of this is a performance penalty of a 3-5% for instantiating single-field models from DB (query_all benchmark of djangobench), less for multi-field models.

I'd like to keep this private API for a while until more is known about what kinds of states are needed."	Cleanup/optimization	new	Database layer (models, ORM)	dev	Normal				Accepted	1	0	0	1	0	0
