{"id":16603304,"url":"https://github.com/dbrgn/django-mathfilters","last_synced_at":"2025-04-05T05:07:21.304Z","repository":{"id":4985153,"uuid":"6143163","full_name":"dbrgn/django-mathfilters","owner":"dbrgn","description":"django-mathfilters provides a set of simple math filters for Django.","archived":false,"fork":false,"pushed_at":"2020-10-13T07:44:11.000Z","size":48,"stargazers_count":169,"open_issues_count":1,"forks_count":29,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-02T04:40:28.791Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbrgn.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-09T15:38:36.000Z","updated_at":"2025-03-22T01:20:39.000Z","dependencies_parsed_at":"2022-08-06T18:00:59.016Z","dependency_job_id":null,"html_url":"https://github.com/dbrgn/django-mathfilters","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fdjango-mathfilters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fdjango-mathfilters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fdjango-mathfilters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fdjango-mathfilters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbrgn","download_url":"https://codeload.github.com/dbrgn/django-mathfilters/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289428,"owners_count":20914464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T00:49:13.185Z","updated_at":"2025-04-05T05:07:21.283Z","avatar_url":"https://github.com/dbrgn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"##################\ndjango-mathfilters\n##################\n\n.. image:: https://github.com/dbrgn/django-mathfilters/workflows/CI/badge.svg\n    :alt: Build status\n    :target: https://github.com/dbrgn/django-mathfilters/actions?query=branch%3Amaster\n\n.. image:: https://pypip.in/d/django-mathfilters/badge.png\n    :alt: PyPI download stats\n    :target: https://crate.io/packages/django-mathfilters\n\n\ndjango-mathfilters is a Python 3 module that provides different simple math\nfilters for Django.\n\nDjango provides an ``add`` template filter, but no corresponding subtracting,\nmultiplying or dividing filters.\n\nDjango ticket `#361 \u003chttps://code.djangoproject.com/ticket/361\u003e`_ has been\nclosed as *wontfix*, so I had to create an alternative that is easy to install\nin a new Django project.\n\nIt currently supports ``int``, ``float`` and ``Decimal`` types, or any other\ntype that can be converted to int or float.\n\n\nInstallation\n============\n\n::\n\n    $ pip install django-mathfilters\n\nThen add ``mathfilters`` to your ``INSTALLED_APPS``.\n\n\nUsage\n=====\n\nYou need to load ``mathfilters`` at the top of your template. The script\nprovides the following filters:\n\n* ``sub`` – subtraction\n* ``mul`` – multiplication\n* ``div`` – division\n* ``intdiv`` – integer (floor) division\n* ``abs`` – absolute value\n* ``mod`` – modulo\n* ``addition`` – replacement for the ``add`` filter with support for float /\n  decimal types\n\n**Example:**\n\n.. sourcecode:: html\n\n    {% load mathfilters %}\n\n    ...\n\n    \u003ch1\u003eBasic math filters\u003c/h1\u003e\n\n    \u003cul\u003e\n        \u003cli\u003e8 + 3 = {{ 8|add:3 }}\u003c/li\u003e\n\n        \u003cli\u003e13 - 17 = {{ 13|sub:17 }}\u003c/li\u003e\n\n        {% with answer=42 %}\n        \u003cli\u003e42 * 0.5 = {{ answer|mul:0.5 }}\u003c/li\u003e\n        {% endwith %}\n\n        {% with numerator=12 denominator=3 %}\n        \u003cli\u003e12 / 3 = {{ numerator|div:denominator }}\u003c/li\u003e\n        {% endwith %}\n\n        \u003cli\u003e|-13| = {{ -13|abs }}\u003c/li\u003e\n    \u003c/ul\u003e\n\n\nVersion Support\n===============\n\nThis module officially supports Python 3.5+ as well as PyPy3. Support for Python\n3.3 and 3.4 is provided on best-effort basis, but there are no CI tests for it.\n\nSupported Django versions are 1.11+, 2.x and 3.x.\n\n\nDevelopment\n===========\n\nThis project uses `Black \u003chttps://black.readthedocs.io/\u003e`__ for\nauto-formatting. Adherence to the rules is enforced in CI.\n\n\nLicense\n=======\n\n`MIT License \u003chttp://www.tldrlegal.com/license/mit-license\u003e`_, see LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrgn%2Fdjango-mathfilters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbrgn%2Fdjango-mathfilters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrgn%2Fdjango-mathfilters/lists"}