django-fluent / django-fluent-comments

A modern, ajax-based appearance for django comments
https://django-fluent.org/
Apache License 2.0
182 stars 90 forks source link

signal needs to be documented or improved #99

Closed bung87 closed 7 years ago

bung87 commented 7 years ago
from fluent_comments.compat import signals as comment_signals  
from fluent_comments.compat import get_model as get_comments_model
comment_signals.comment_was_posted.connect(comment_handler, sender = get_comments_model(),dispatch_uid="fluent_comments_comment_posted")

get_comments_model will return threadedcomment model class or django's comment model,so the handler function will receive different type of comment instance,I think write django-fluent-comments custom signal will be great,so developer will not confuse with this.and in fluentcomments models.py specify a dispatch_uid to signal receiver if just use signal from django's comment signal,or use fluentcomments custom signal and in views.py send signal to FluentComment.

vdboor commented 7 years ago

I'm curious, does it matter who the sender is? You could listen to the comment_was_posted signal directly:

from django_comments.signals import comment_was_posted

@receiver(signals.comment_was_posted)
def on_comment_posted(comment, request, **kwargs):
    pass