Skip to main content

A Django app to work with Iranian currency.

Project description

Django Persian Currency

A simple Django template tag for formatting Iranian currency values (تومان) into human-readable formats like:

  • 1,000,0001 میلیون تومان
  • 500,000500 هزار تومان
  • 123,456123,456 تومان

✨ Features

  • Converts raw integers into میلیارد, میلیون, or هزار تومان where appropriate
  • Falls back to comma-separated تومان when not divisible
  • Safe default for invalid input
  • Optional support for Persian digits (you can easily enable it)

🚀 Installation

pip install django_persian_currency

Add 'django_persian_currency' to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    ...
    'django_persian_currency',
]

🛠 Usage

In any Django template, first load the template tags:

{% load toman_filters %}

Then use the format_toman filter:

{{ 1000000|format_toman }}  {# Output: 1 میلیون تومان #}
{{ 725500|format_toman }}   {# Output: 725,500 تومان #}
{{ 500000|format_toman }}   {# Output: 500 هزار تومان #}

🧪 Testing

You can test it inside a Django shell:

python manage.py shell
from django.template.defaultfilters import register
from django_persian_currency.templatetags.iran_money_display import toman_display

toman_display(1500000)  # Output: '1 میلیون تومان'

🤝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_persian_currency-0.1.3.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_persian_currency-0.1.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file django_persian_currency-0.1.3.tar.gz.

File metadata

  • Download URL: django_persian_currency-0.1.3.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for django_persian_currency-0.1.3.tar.gz
Algorithm Hash digest
SHA256 03bf8a1f71ba18a6aef3e0af82de91e5d834d8d04923858699a1413ccfa61a85
MD5 0e442b2d6280d26c175dc8d62035c4d1
BLAKE2b-256 f8a51d81f167859a56ad3a45991c31a90dc48eaa103a802c915fb5ca4ad9543c

See more details on using hashes here.

File details

Details for the file django_persian_currency-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_persian_currency-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 48ae789e8511d46e0c00be92c0a506591d93f352616a338660ca118f05e20612
MD5 f9a746a099d60ce9a9b074460857081d
BLAKE2b-256 2f2b36a82ea1234c7814396fe6f6d539d5e77604bd94fa004a021bcf8a9ffce9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page