from django import template

register = template.Library()

@register.filter
def filename(value):
    """
    Extract just the filename from a file path.
    Example: 'documents/resume.pdf' -> 'resume.pdf'
    """
    if not value:
        return ''

    # Convert to string and split by path separators
    import os
    return os.path.basename(str(value))

@register.filter
def split(value, delimiter):
    """
    Split a string by a delimiter and return a list.
    This is a custom implementation of the split functionality.
    """
    if not value:
        return []

    return str(value).split(delimiter)
