#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):

 Hi Anssi,

 Thanks for your feedback.

 I have made some changes to the patch, notably:
 * lazy_related_operation now takes multiple related model arguments.
 * I've simplified and removed some now-unnecessary type checks in
 [https://github.com/django/django/pull/3984/files#diff-
 3010fc5a498b7171c342520f34507968R283 RelatedField.contribute_to_class] and
 [https://github.com/django/django/pull/3984/files#diff-
 3010fc5a498b7171c342520f34507968R2022
 create_many_to_many_intermediary_model] (the latter now takes advantage of
 the first bullet point)
 * I've
 
[https://github.com/AlexHill/django/commit/d27869e3dcb03eccf7c3aa09d911b5206bda9d0a
 made a change to how SQLite schema alterations work] due to a bit of
 friction in the above. This is a small change in terms of code and I
 believe for the better, but will want some eyes on it.

 Regarding unhandled relations: if someone waits for a model that doesn't
 exist the signal will never fire. I suppose at the end of the app
 registry's loading phase would be a good place to check for those. Issuing
 a warning might be the go, as it's always possible (though unlikely) that
 the user intends to define a model later...

 While looking into this, ran into #21175. Currently abstract models don't
 fire class_prepared, so lazy operations involving abstract models remain
 unhandled. In practise it doesn't matter because their concrete children
 work fine, but it would be worth fixing.

 Cheers,
 Alex

--
Ticket URL: <https://code.djangoproject.com/ticket/24215#comment:7>
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.be0d8b7202c800558b152e9625314d5a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to