def count_discussions_handler(sender, **kwargs):
 if (kwargs.get('instance') and kwargs.get('created')):
  return
 comment = ((('comment' in kwargs) and kwargs['comment']) or kwargs['instance'])
 entry = comment.content_object
 if isinstance(entry, Entry):
  entry.comment_count = entry.comments.count()
  entry.pingback_count = entry.pingbacks.count()
  entry.trackback_count = entry.trackbacks.count()
  entry.save(update_fields=['comment_count', 'pingback_count', 'trackback_count'])

def count_discussions_handler ( sender , ** kwargs ) : if ( kwargs . get ( 'instance' ) and kwargs . get ( 'created' ) ) : return comment = ( ( ( 'comment' in kwargs ) and kwargs [ 'comment' ] ) or kwargs [ 'instance' ] ) entry = comment . content_object if isinstance ( entry , Entry ) : entry . comment_count = entry . comments . count ( ) entry . pingback_count = entry . pingbacks . count ( ) entry . trackback_count = entry . trackbacks . count ( ) entry . save ( update_fields = [ 'comment_count' , 'pingback_count' , 'trackback_count' ] )
update the count of each type of discussion on an entry .