Exemplo n.º 1
0
def decrement_counter_post_save(sender, instance, **kwargs):
    if getattr(instance, "is_public", True) and not getattr(instance, "is_removed", False):
        key = get_cache_key_from_comment(instance)
        try:
            cache.decr(key)
        except ValueError:
            pass
Exemplo n.º 2
0
def increment_counter(sender, comment, **kwargs):
    if getattr(comment, "is_public", True):
        key = get_cache_key_from_comment(comment)
        try:
            cache.incr(key)
        except ValueError:
            pass
Exemplo n.º 3
0
def decrement_counter_flagged(sender, flag, comment, **kwargs):
    if flag.flag == flag.MODERATOR_DELETION and getattr(comment, "is_public", True):
        key = get_cache_key_from_comment(comment)
        try:
            cache.decr(key)
        except ValueError:
            pass