We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am using Python 3.7.1, Django 2.0.9 This issue apparently was mentioned, but haven't seen any changes to deal with it.
I am trying to use the following signals follower_created, followee_created, following_created.
follower_created
followee_created
following_created
I connected it like this
@receiver([follower_created, followee_created, following_created], sender=Follow) def on_following_created(sender, **kwargs): print('on_following_created') print(kwargs)
I was able to get it to work by changing how the signals were being triggered in the models.py
models.py
follower_created.send(sender=self, follower=follower) followee_created.send(sender=self, followee=followee) following_created.send(sender=self, following=relation)
to
follower_created.send(sender=self.model, follower=follower) followee_created.send(sender=self.model, followee=followee) following_created.send(sender=self.model, following=relation)
assuming the ideal usage:
@receiver(..., sender=Follow)
is for sender to be the model.
sender
Without making any changes to how the signals are triggered. Connecting would just be
@receiver(..., sender=Follow.objects) # looks weird, but works (not sure intentional usage)
I have not checked the other signals, but I believe any signal being triggered as .send(sender=self) should be changed to .send(sender=self.model).
.send(sender=self)
.send(sender=self.model)
Edit:
I also tried with follower_removed, followee_removed, following_removed and it does not work with the following connection
follower_removed
followee_removed
following_removed
@receiver([follower_removed, followee_removed, following_removed], sender=Follow) def deleteFollowNotification(sender, **kwargs): print('deleteFollowNotification') print(kwargs)
I had to change
follower_removed.send(sender=rel, follower=rel.follower) followee_removed.send(sender=rel, followee=rel.followee) following_removed.send(sender=rel, following=rel)
follower_removed.send(sender=rel._meta.model, follower=rel.follower) followee_removed.send(sender=rel._meta.model, followee=rel.followee) following_removed.send(sender=rel._meta.model, following=rel)
@receiver([follower_removed, followee_removed, following_removed], sender=Follow.objects) # using Follow.objects
doesn't work either.
in models.py
rel = Follow.objects.get(follower=follower, followee=followee)
is an instance and I have no way of triggering follower_removed, followee_removed, following_removed.
Either sender in .send(sender=MyModel) needs to always be the model class or I am using these signals incorrectly.
.send(sender=MyModel)
I have checked Django release notes and haven't found anything that would change how signals work.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am using Python 3.7.1, Django 2.0.9
This issue apparently was mentioned, but haven't seen any changes to deal with it.
I am trying to use the following signals
follower_created
,followee_created
,following_created
.I connected it like this
I was able to get it to work by changing how the signals were being triggered in the
models.py
to
assuming the ideal usage:
@receiver(..., sender=Follow)
is for
sender
to be the model.Without making any changes to how the signals are triggered.
Connecting would just be
I have not checked the other signals, but I believe any signal being triggered as
.send(sender=self)
should be changed to.send(sender=self.model)
.Edit:
I also tried with
follower_removed
,followee_removed
,following_removed
and it does not work with the following connectionI had to change
to
doesn't work either.
in
models.py
is an instance and I have no way of triggering
follower_removed
,followee_removed
,following_removed
.Either sender in
.send(sender=MyModel)
needs to always be the model class or I am using these signals incorrectly.I have checked Django release notes and haven't found anything that would change how signals work.
The text was updated successfully, but these errors were encountered: