-
Notifications
You must be signed in to change notification settings - Fork 16
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
polls: add new signal which is called after a user voted on a poll #1688
Conversation
3378c06
to
7d3322c
Compare
@@ -0,0 +1,3 @@ | |||
from django.dispatch import Signal | |||
|
|||
poll_voted = Signal() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add here the arguments that are needed for the signal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a docstring
adhocracy4/polls/api.py
Outdated
@@ -178,6 +179,8 @@ def vote(self, request, pk): | |||
self.save_vote(question, vote_data, creator, content_id) | |||
|
|||
poll = self.get_object() | |||
print("##########################################") | |||
poll_voted.send(sender=None, poll=poll, creator=creator, content_id=content_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sender is the poll view, I have added it as the self.__class__
in my PR for mB kiezradar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the print statement can go I believe :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few things
adhocracy4/polls/api.py
Outdated
@@ -178,6 +179,8 @@ def vote(self, request, pk): | |||
self.save_vote(question, vote_data, creator, content_id) | |||
|
|||
poll = self.get_object() | |||
print("##########################################") | |||
poll_voted.send(sender=None, poll=poll, creator=creator, content_id=content_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the print statement can go I believe :)
7d3322c
to
fc7d8fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an extra thing for the tests
fc7d8fc
to
a563444
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
Tasks