PageRenderTime 23ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/docs/ref/contrib/comments/signals.txt

https://code.google.com/p/mango-py/
Plain Text | 91 lines | 64 code | 27 blank | 0 comment | 0 complexity | 9e60ad21cf4c26a23ccf387ea2df6b7d MD5 | raw file
 1================================
 2Signals sent by the comments app
 3================================
 4
 5.. module:: django.contrib.comments.signals
 6   :synopsis: Signals sent by the comment module.
 7
 8The comment app sends a series of :doc:`signals </topics/signals>` to allow for
 9comment moderation and similar activities. See :doc:`the introduction to signals
10</topics/signals>` for information about how to register for and receive these
11signals.
12
13comment_will_be_posted
14======================
15
16.. data:: django.contrib.comments.signals.comment_will_be_posted
17   :module:
18
19Sent just before a comment will be saved, after it's been sanity checked and
20submitted. This can be used to modify the comment (in place) with posting
21details or other such actions.
22
23If any receiver returns ``False`` the comment will be discarded and a 403 (not
24allowed) response will be returned.
25
26This signal is sent at more or less the same time (just before, actually) as the
27``Comment`` object's :data:`~django.db.models.signals.pre_save` signal.
28
29Arguments sent with this signal:
30    
31    ``sender``
32        The comment model.
33        
34    ``comment``
35        The comment instance about to be posted. Note that it won't have been
36        saved into the database yet, so it won't have a primary key, and any
37        relations might not work correctly yet.
38        
39    ``request``
40        The :class:`~django.http.HttpRequest` that posted the comment.
41        
42comment_was_posted
43==================
44
45.. data:: django.contrib.comments.signals.comment_was_posted
46   :module:
47   
48Sent just after the comment is saved.
49
50Arguments sent with this signal:
51    
52    ``sender``
53        The comment model.
54        
55    ``comment``
56        The comment instance that was posted. Note that it will have already
57        been saved, so if you modify it you'll need to call
58        :meth:`~django.db.models.Model.save` again.
59        
60    ``request``
61        The :class:`~django.http.HttpRequest` that posted the comment.
62
63comment_was_flagged
64===================
65
66.. data:: django.contrib.comments.signals.comment_was_flagged
67   :module:
68
69Sent after a comment was "flagged" in some way. Check the flag to see if this
70was a user requesting removal of a comment, a moderator approving/removing a
71comment, or some other custom user flag.
72
73Arguments sent with this signal:
74    
75    ``sender``
76        The comment model.
77        
78    ``comment``
79        The comment instance that was posted. Note that it will have already
80        been saved, so if you modify it you'll need to call
81        :meth:`~django.db.models.Model.save` again.
82        
83    ``flag``
84        The :class:`~django.contrib.comments.models.CommentFlag` that's been
85        attached to the comment.
86        
87    ``created``
88        ``True`` if this is a new flag; ``False`` if it's a duplicate flag.
89        
90    ``request``
91        The :class:`~django.http.HttpRequest` that posted the comment.