#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:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by AlexHill):
Hey Collin,
Sorry about the delay, I didn't get an email notification of your comment.
Thanks for replying.
I use it this in Mezzanine to
[https://github.com/stephenmcd/mezzanine/blob/8e0ff285c9761642cc8544f59b583a75b7821fff/mezzanine/accounts/models.py
wait on both a user model and a profile model] which are both string
references. It's more defensive there than strictly necessary but it
demonstrates the point. I leave more creative uses to future generations.
:)
I hear you about `add_lazy_relation` being used outside of Django (I do
it). If it is used a lot, I see that as a good reason to clean up and
document the API, though with an extended deprecation timeline. I've done
a quick search on GitHub but
[https://github.com/search?l=python&q=add_lazy_relation&type=Code&utf8=%E2%9C%93
most of the results are Django builds in other people's repos], so it's
not all that helpful. Perhaps I should poll django-users to get a sense of
how widely it's used?
I propose:
* Move the core generic functionality into the Apps registry and
reimplement `add_lazy_relation` accordingly as in this PR.
* Include `Apps.lazy_model_operation` in the public app registry API and
document it [https://docs.djangoproject.com/en/1.7/ref/applications
/#application-registry here].
Then either:
* Scrap the new `lazy_model_operation` helper and don't deprecate
`add_lazy_relation` at all – simply re-implement it while retaining the
existing signature, or
* Proceed as per my plan but push removal of `add_lazy_relation` back to
the next LTS. Possibly go the whole hog and document
`lazy_model_operation` as well.
Now wishing this had come up a bit earlier and snuck into 1.8!
Cheers,
Alex
--
Ticket URL: <https://code.djangoproject.com/ticket/24215#comment:5>
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/066.e496a44b6c59830c848e128d820573a6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.