Opened 17 years ago
Closed 16 years ago
#7538 closed (wontfix)
add signal when all models are loaded
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently there is no signal when the models cache is fully populated.
I wrote a widget framework which loads widgets from the installed apps. Currently there is no hook to use to initialize additional models after all models are loaded. We run in many strange problems because the widgets may import models itself.
patch adds a modules_loaded signal which is fired after the AppCache populated the cache completely, allows many nice things to be done after the app started completly.
Attachments (1)
Change History (8)
by , 17 years ago
Attachment: | django_models_loaded_signal.patch added |
---|
comment:1 by , 16 years ago
milestone: | 1.0 alpha → post-1.0 |
---|
According to ticket organization defined in http://code.djangoproject.com/wiki/VersionOneRoadmap#how-you-can-help 1.0 alpha tickets should be just features in the Must have (http://code.djangoproject.com/wiki/VersionOneRoadmap#must-have-features) list.
Change to 1.0 beta if you can make this feature be added to May be features (http://code.djangoproject.com/wiki/VersionOneRoadmap#maybe-features).
comment:2 by , 16 years ago
milestone: | post-1.0 → 1.0 beta |
---|
sorry, but i have to disagree. the django model loader is very nice but often causes problems when doing non standard things. this signal is absolutely non invasive. can't cause problems in any way and is minimal in overhead. the gain is much wider then the cost.
comment:3 by , 16 years ago
milestone: | 1.0 beta |
---|
This is a feature request that has had no discussion on Django developers. It isn't a candidate for v1.0.
comment:4 by , 16 years ago
milestone: | → post-1.0 |
---|---|
Needs documentation: | set |
Needs tests: | set |
Triage Stage: | Unreviewed → Design decision needed |
comment:6 by , 16 years ago
Cc: | added |
---|
comment:7 by , 16 years ago
Cc: | removed |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
After some short discussion on the list and further explanation by Malcolm, this patch does not work the way Django works and is far too specific to the AppCache, which should remain an internal implementation detail. Models are not loaded at any one specific point in Django; rather, they are loaded the first time a Model is attempted to be imported. Because of this you would never be guaranteed of this always behaving the same way. Further, there is the potential in the future that Django would enable partial loading (only the models necessary), rendering this behavior useless.
adds models_loaded signal