# django-wcwidth-filter **Repository Path**: mirrors_c-bata/django-wcwidth-filter ## Basic Information - **Project Name**: django-wcwidth-filter - **Description**: A collection of Django template filters for multi-width characters. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-06-09 - **Last Updated**: 2025-12-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ===================== django-wcwidth-filter ===================== A collection of Django template filters for multi-width characters. Installation ------------ .. code-block:: console $ python3 -m pip install django-wcwidth-filter Usage ----- wcswidth filter ~~~~~~~~~~~~~~~ .. code-block:: python >>> template = Template("{% load wcwidth %}{{ x | wcswidth }}") >>> context = Context({ >>> "x": "Hello", >>> }) >>> template.render(context) 5 >>> context = Context({ >>> "x": "こんにちは", >>> }) >>> template.render(context) 10 truncate_wcswidth filter ~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: python >>> template = Template("{% load wcwidth %}{{ x | truncate_wcswidth:4 }}") >>> context = Context({ >>> "x": "Hello", >>> }) >>> template.render(context) "Hel…" >>> template = Template("{% load wcwidth %}{{ x | truncate_wcswidth:9 }}") >>> context = Context({ >>> "x": "こんにちは", >>> }) >>> template.render(context) 'こんにち…'