#30662: Add a signal at the end of Model.refresh_from_db()
-------------------------------------+-------------------------------------
Reporter: Craig de | Owner: nobody
Stigter |
Type: New | Status: new
feature |
Component: Database | Version: 2.2
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have an app that allows callers to subscribe to a `post_save_changed`
signal on particular fields, when those fields have changed.
It works by recording values in the `post_init` signal, then checking
their values in the `post_save` signal, and then triggering its own
`post_save_changed` signal if the values are different.
The problem is that currently there's no way this can detect someone
calling `Model.refresh_from_db()`. If I could detect that, I would
overwrite the stored values from `post_init` with some new values.
Otherwise my app may detect 'changes' which have actually already been
applied to the database.
A `post_refresh_from_db` signal seems conspicuously absent. Or perhaps
`post_init` should be called again when `refresh_from_db` is called? That
would also solve my problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/30662>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.0eb38eafa852a7bd7ff161f5051322e3%40djangoproject.com.