Code

Opened 6 years ago

Closed 5 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@… 6 years ago.
adds models_loaded signal

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by django@…

adds models_loaded signal

comment:1 Changed 6 years ago by garcia_marc

  • milestone changed from 1.0 alpha to post-1.0
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 6 years ago by poelzi

  • milestone changed from post-1.0 to 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 Changed 6 years ago by russellm

  • milestone 1.0 beta deleted

This is a feature request that has had no discussion on Django developers. It isn't a candidate for v1.0.

comment:4 Changed 6 years ago by ericholscher

  • milestone set to post-1.0
  • Needs documentation set
  • Needs tests set
  • Triage Stage changed from Unreviewed to Design decision needed

comment:5 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:6 Changed 5 years ago by anonymous

  • Cc polarcowz@… added

comment:7 Changed 5 years ago by DanielLindsley

  • Cc polarcowz@… removed
  • Resolution set to wontfix
  • Status changed from new to 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.