#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):
Actually, it's a bit more complicated than just having abstract models
fire class_prepared.
We try get_registered_model to see if a model is ready or not, which will
always fail with abstract models because they don't appear in the
registry. In the case that the abstract model really isn't ready, the
callback will still fire when it's constructed (assuming #21175 is fixed),
but only the first time.
Is there a reason the app registry doesn't keep track of abstract models?
Note these inconsistencies are present in Django now, they aren't
introduced by this patch. Again in practise it doesn't really matter – in
fact you get errors if some of the lazy operations *are* run with abstract
models. However if we want to be able to provide warnings for unhandled
lazy operations, we have to sort something out with abstract models or
they'll raise false alarms.
Cheers,
Alex
--
Ticket URL: <https://code.djangoproject.com/ticket/24215#comment:8>
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.e99b8bf55ddafe60d96b8b9816a5b0fa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.