django-num2fa
is a wrapper around num2fa package which provides a set of filters to convert numbers to Persian numbers and words.
pip install -U django-num2fa
That's it!
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 }}
We welcome contributions! To learn how you can contribute, please check the Contributing document.
This work is licensed under the terms of the GNU Affero General Public License (AGPL).