Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#19212 closed New feature (duplicate)

app_cache_ready signal

Reported by: Craig de Stigter Owned by: nobody
Component: Database layer (models, ORM) Version: 1.5-alpha-1
Severity: Normal Keywords:
Cc: flavio.curella@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This thread on django-users proposed the concept of a signal for when all apps are loaded. We've also come across a use case that requires this.

Basically class_prepared is fired during loading of the app cache. So during handling of class_prepared, ForeignKey.rel.to may not yet be resolved, and that limits what we can do.

So we wrote a 3-line patch which adds a signal that gets fired when the app cache finishes loading.

Because this can't be done outside of core without monkey-patching, I'd say it belongs in core.

Here's another request for this on SO: http://stackoverflow.com/questions/1333019/django-audittrail-lazy-relations

Our 3 line patch: https://github.com/koordinates/django/commit/cfa687409698ab9c5ffd150d0c89aba7d361739f

Change History (2)

comment:1 Changed 4 years ago by Russell Keith-Magee

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: duplicate
Status: newclosed

This is a long standing request, but it's not as simple as "just add a signal", because there isn't currently any reliable point at which we can guarantee that all apps have been loaded. To see the historical discussion, search for "App Refactor" or "App loading refactor" in the archives; ticket #3591 is the placeholder for the work.

comment:2 Changed 4 years ago by Flavio Curella

Cc: flavio.curella@… added
Note: See TracTickets for help on using tickets.
Back to Top