#24215: Refactor of lazy model operations
----------------------------------------------+-----------------------
Reporter: AlexHill | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Database layer (models, ORM) | Version: 1.8alpha1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+-----------------------
I dealt with `add_lazy_relation()` a few months ago working on Mezzanine
and I thought it could use some detangling.
Now that the list of pending operations is stored in the Apps class, it
makes sense to put the related methods on that class as well. Running a
function when a model is loaded seems an appropriate job for the app
registry object.
I've introduced a more generic API, whereby a user-supplied function can
be called once any number of models are ready, with those freshly-loaded
models as its arguments (plus optional kwargs), a helper function for
related models, and the old `add_lazy_relation()` reimplemented in terms
of the new API with a deprecation warning.
--
Ticket URL: <https://code.djangoproject.com/ticket/24215>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.cc4606fba7fdb1ab19c28093a2ce1e32%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.