-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signals can not connect to OneToOneField
.
#572
Comments
is it bug or what you are suggesting? |
Yeah, I think it's a bug. |
954-Ivory
added a commit
to 954-Ivory/django-celery-beat
that referenced
this issue
Aug 21, 2022
auvipy
added a commit
that referenced
this issue
Oct 13, 2022
* Fixed signals can not connect to OneToOneField (#572) * Remove unused import. * Changed `PeriodicTasks.pre_save` and `PeriodicTasks.pre_delete` in `PeriodicTasks.save` and `PeriodicTasks.delete` * Update django_celery_beat/models.py * Append the unit-test * Correction of notes * Append test-case for: O2O-rel instance be deleted * Add the docs * Format code according to `pycodestyle` Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because django let
sender = self.__class__
:https://github.com/django/django/blob/e9fd2b572410b1236da0d3d0933014138d89f44e/django/db/models/base.py#L860
If you inheritance from
PeriodicTask
(same asOneToOneField
), and overwritesave()
in your field, like this:The
pre_save.sender
will beYourPeriodicTask
, notPeriodicTask
.So, the signal will not be receive.
The text was updated successfully, but these errors were encountered: