Skip to content
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

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

goapunk
Copy link
Contributor

@goapunk goapunk commented Nov 6, 2024

Tasks

  • PR name contains story or task reference
  • Documentation (docs and inline)
  • Tests (including n+1 and django_assert_num_queries where applicable)
  • Changelog

@@ -0,0 +1,3 @@
from django.dispatch import Signal

poll_voted = Signal()
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a docstring

@@ -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)
Copy link
Contributor

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.

Copy link
Contributor

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, added

Copy link
Contributor

@m4ra m4ra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few things

@@ -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)
Copy link
Contributor

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 :)

@goapunk goapunk requested a review from m4ra November 13, 2024 16:20
Copy link
Contributor

@m4ra m4ra left a 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

@goapunk goapunk requested a review from m4ra November 18, 2024 13:37
Copy link
Contributor

@m4ra m4ra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@m4ra m4ra merged commit 469ffe0 into main Nov 18, 2024
5 checks passed
@m4ra m4ra deleted the jd-2024-11-user-voted-signal branch November 18, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants