#24231: Regression in availability of `_meta.get_field()` before app registry is
fully populated
-------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+-------------------------------------
Comment (by carljm):
I've spent the past few days wavering on that question myself :-) The
proposed fix for #24146 makes `get_field()` and `get_fields()` usable
during `AppConfig.ready()`, but not in a `class_prepared` signal handler.
On the one hand:
- People should generally be using `AppConfig.ready()` rather than
`class_prepared` signal handlers, and `class_prepared`, though documented,
is already sort of pseudo-private; the docs say "Django uses this signal
internally; it’s not generally used in third-party applications."
So in purely practical terms, I'm not sure there's a strong case for this
ticket anymore.
On the other hand, it still seems wrong to me that a single model class
provides no public API that can be used to introspect its own declared
fields safely, regardless of whether the entire app registry is ready or
not.
So I'm still willing to update the PR for this to provide such an API, but
if others think it should be closed, I won't argue.
--
Ticket URL: <https://code.djangoproject.com/ticket/24231#comment:12>
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/064.f6c2b6b590e307b9ac300760cca7ad37%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.