Opened 8 years ago

Closed 8 years ago

#7538 closed (wontfix)

add signal when all models are loaded

Reported by: django@… Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:

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)

django_models_loaded_signal.patch (1.1 KB) - added by django@… 8 years ago.
adds models_loaded signal

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by django@…

adds models_loaded signal

comment:1 Changed 8 years ago by Marc Garcia

milestone: 1.0 alphapost-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 Changed 8 years ago by Daniel Poelzleithner

milestone: post-1.01.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 Changed 8 years ago by Russell Keith-Magee

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 Changed 8 years ago by Eric Holscher

milestone: post-1.0
Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedDesign decision needed

comment:5 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:6 Changed 8 years ago by anonymous

Cc: polarcowz@… added

comment:7 Changed 8 years ago by DanielLindsley

Cc: polarcowz@… removed
Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top