--- id: django-mathfilters version: "1.0.0" license: MIT license_treatment: permissive maintenance: abandoned --- # django-mathfilters — A set of simple math filters for Django License: permissive · Maintenance: abandoned · Downloads: 636.8K/mo ## What it is and what it does django-mathfilters extends Django's template language with arithmetic filters for use in templates. Django provides an `add` filter but omits subtraction, multiplication, division, and other basic math operations; this package fills that gap by offering `sub`, `mul`, `div`, `intdiv`, `abs`, `mod`, and an enhanced `addition` filter that handles float and Decimal types in addition to integers. The package is a simple, zero-dependency Django app that you install via pip and register in INSTALLED_APPS. Once loaded in a template with `{% load mathfilters %}`, you can apply arithmetic operations inline—for example, `{{ 13|sub:17 }}` or `{{ answer|mul:0.5 }}`—without writing custom template tags or view logic. Use it for: - Display calculated values in Django templates without writing custom template tags—e.g., show discounted prices or percentage calculations. - Perform simple arithmetic on template variables for display purposes, such as dividing totals by counts to show averages. - Handle float and Decimal arithmetic in templates where Django's built-in `add` filter would not suffice. - Reduce boilerplate by avoiding custom template tag definitions for straightforward math operations. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides Django template filters for basic arithmetic operations—subtraction, multiplication, division, modulo, and absolute value—that Django's built-in template system does not include. Yes, if you are on Django 1.11–3.x with Python 3.5–3.7 and need simple math filters in templates. No, if you are using modern Django or Python versions—the package is abandoned and has not been updated since 2020, so compatibility with current releases is uncertain. Consider writing a custom template tag or moving calculations to your view layer if you need active maintenance. ## Install pip install django-mathfilters uv add django-mathfilters poetry add django-mathfilters ## Installing django-mathfilters Before you install: Installation is straightforward with no runtime dependencies. However, the package is abandoned—last commit was 2020-10-13 and no releases since 2020-02-10—so it will not receive bug fixes or updates for modern Django or Python versions. License in practice: MIT License is permissive; you can use, modify, and distribute this package freely with minimal restrictions. Quickstart: pip install django-mathfilters Then add 'mathfilters' to INSTALLED_APPS in settings.py. In a template: {% load mathfilters %} {{ 13|sub:17 }} {{ 42|mul:0.5 }} {{ 12|div:3 }} Requires Django to be installed and configured; the package itself has no runtime dependencies but is a Django app extension. Verify before relying: - Whether the package works with Django versions released after 2020 without issues. - Current compatibility with Python 3.8+ given the last release predates those versions. - Whether float/Decimal arithmetic in filters handles edge cases (NaN, infinity, precision loss). ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 636.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django template math filters, django arithmetic template filters, django subtraction multiplication division filters, django template calculator, django math operations templates, django-template-filters, template-math [View on SkillFed](https://skillfed.io/packages/django-mathfilters) · [View on PyPI](https://pypi.org/project/django-mathfilters/)