<commit_before>from django import template

register = template.Library()


def is_authenticated(session):
    if 'user' in session and 'is_authenticated' in session:
        return True
    return False


def is_admin(session):
    if 'user' in session and 'is_admin' in session:
        return True
    return False


register.filter('is_authenticated', is_authenticated)
register.filter('is_admin', is_admin)<commit_msg>[feature/backoffice] refactor: login and admin filters<commit_after>from django import template

register = template.Library()


def is_authenticated(session):
    return 'user' in session and 'is_authenticated' in session


def is_admin(session):
    return 'user' in session and 'is_admin' in session and session['is_admin'] is True


register.filter('is_authenticated', is_authenticated)
register.filter('is_admin', is_admin)
{'fraction_non_alphanumeric': 0.08930669800235018, 'fraction_numerical': 0.0, 'mean_word_length': 5.129496402877698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4802430', 'n_tokens_mistral': 257, 'n_tokens_neox': 239, 'n_words': 76}