from pathlib import Path

from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()


@register.filter
@stringfilter
def filename(path):
    """Removes traceback lines from a string (if any). It has no effect when
    no 'Traceback' pattern has been found.

    Returns: raws before the 'Traceback' pattern
    """
    return Path(path).name

from pathlib import Path

from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()


@register.filter
@stringfilter
def filename(path):
    """Removes parent path from a relative or absolute filename

    Returns: the filename
    """
    return Path(path).name

Fix filename template tag docstring
Fix filename template tag docstring
