signals.py 1.0 KB

123456789101112131415161718192021
  1. """
  2. Signals relating to comments.
  3. """
  4. from django.dispatch import Signal
  5. # Sent just before a comment will be posted (after it's been approved and
  6. # moderated; this can be used to modify the comment (in place) with posting
  7. # details or other such actions. If any receiver returns False the comment will be
  8. # discarded and a 400 response. This signal is sent at more or less
  9. # the same time (just before, actually) as the Comment object's pre-save signal,
  10. # except that the HTTP request is sent along with this signal.
  11. comment_will_be_posted = Signal(providing_args=["comment", "request"])
  12. # Sent just after a comment was posted. See above for how this differs
  13. # from the Comment object's post-save signal.
  14. comment_was_posted = Signal(providing_args=["comment", "request"])
  15. # Sent after a comment was "flagged" in some way. Check the flag to see if this
  16. # was a user requesting removal of a comment, a moderator approving/removing a
  17. # comment, or some other custom user flag.
  18. comment_was_flagged = Signal(providing_args=["comment", "flag", "created", "request"])