from django import template

from core.models import UserAccessibilitySettings

register = template.Library()


@register.simple_tag
def get_accessibility_settings(user):
    if not getattr(user, "is_authenticated", False):
        return None
    row, _ = UserAccessibilitySettings.objects.get_or_create(user=user)
    return row
