Skip to content

A set of Django template tags to convert numbers into Persian numbers or words

License

Notifications You must be signed in to change notification settings

iranian-github/django-num2fa

Repository files navigation

Django Num2Fa

PyPI releases License

django-num2fa is a wrapper around num2fa package which provides a set of filters to convert numbers to Persian numbers and words.

Installation

pip install -U django-num2fa

That's it!

Usage

First, add django_num2fa inside your INSTALLED_APPS:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_num2fa',
    # other packages
]

load num2fa inside your template:

{% load num2fa %}

then, wherever you have a number in your code template, pipe it with one of the fa_numbers, fa_words, and fa_ordinal_words template filters.

{% load num2fa %}

{{ number | fa_numbers }}
{{ number | fa_words }}
{{ number | fa_ordinal_words }}

Contributing

We welcome contributions! To learn how you can contribute, please check the Contributing document.

License

This work is licensed under the terms of the GNU Affero General Public License (AGPL).

About

A set of Django template tags to convert numbers into Persian numbers or words

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published