from django import template

register = template.Library()

@register.filter(name='reacted_by')
def reacted_by(post, user):
    if user.is_authenticated:
        return post.reactions.filter(user=user).exists()
    return False

@register.filter(name='get_item')
def get_item(dictionary, key):
    return dictionary.get(key)
