#18532: Mark when instance is loaded from database for pre-/post-init receivers.
-------------------------------------+-------------------------------------
     Reporter:  vzima                |                    Owner:  nobody
         Type:  New feature          |                   Status:  closed
    Component:  Database layer       |                  Version:  1.4
  (models, ORM)                      |               Resolution:  wontfix
     Severity:  Normal               |             Triage Stage:
     Keywords:                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * status:  new => closed
 * resolution:   => wontfix
 * needs_tests:   => 0
 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * type:  Uncategorized => New feature


Comment:

 Could you provide an use-case? I have been wondering if the pre/post_init
 signals are needed at all (instead of pre/post init hooks). So, I am
 interested in how the pre/post_init signals are used more generally.

 This will not be easily done. The pre_init/post_init signals are sent from
 `model.__init__` (and they have to be sent from there). The init API is
 part of public API. So, you can't add a "from_db" flag to `__init__` to
 pass it to the signals.

 If you can find a nice way to pass that information to the signals, then I
 don't see any harm in adding the information to the signals. However, I am
 closing this wontwix as I don't see any easy way to pass the information
 to the signals. If I am mistaken and there is a way to achieve this, then
 please reopen.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18532#comment:1>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to