#24215: Refactor of lazy model operations
-------------------------------------+-------------------------------------
     Reporter:  AlexHill             |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by AlexHill:

Old description:

> 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.
>
> Pull request at https://github.com/django/django/pull/3984

New description:

 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.

 New pull request, now targeting master rather than 1.8, at
 https://github.com/django/django/pull/4130

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24215#comment:19>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.0ce9d120b6b6afee91e7e975233b2b52%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to