Remove django-core uses of Model pre_init and post_init
|Reported by:||jdunck||Owned by:||jdunck|
|Component:||Database layer (models, ORM)||Version:||1.4|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
GenericForeignKey and ImageField use pre_init and post_init - signals which are fired on each model construction.
The signal handling code is heavy relative to plain function dispatch, and is optimized for the zero-handler case. It's unfortunate that Django ships with these signals being used, as it could instead use an internal hook for the needed initialization, and this approach would be faster.
I'm working on a patch to switch to a more direct hook (which any field could use instead of pre/post_init).
(Marking triage accepted since discussed and +1'd by some core folks.)
Change History (8)
comment:2 Changed 4 years ago by jdunck
- Owner changed from nobody to jdunck
- Status changed from new to assigned