Skip to main content

currency, exchange rates and conversions support for django

Project description

Currency, exchange rate and conversions support for django projects.

Install

django-exchange is available on pypi repositories so youre free to use pip or easy_install:

$ pip install django-exchange

Or you might want to install from source:

$ wget https://github.com/metglobal/django-exchange/archive/django-exchange-xxx.zip
$ unzip django-exchange-xxx.zip
$ cd django-exchange-xxx
$ python setup.py install

Add exchange into your INSTALLED_APPS settings of your django project:

INSTALLED_APPS += [
    'exchange',
]

Don’t forget to sync your db to create corresponding database tables:

$ python manage.py syncdb

Populating Data

django-exchange supports populating currency and exchange rates using a service provider automatically. Currently it has built in support for openexchangerates.org service. It is only a matter of supplying an api key obtained from http://openexchangerates.org as django settings using the key OPENEXCHANGERATES_API_KEY:

OPENEXCHANGERATES_API_KEY = '<YOU_API_KEY_HERE>'

Now you can populate you currency and exchange rates magically by typing:

$ python manage.py update_rates

Quickstart

Currency conversions is dead easy. There are auxilaray methods helps you calculate conversions using populated exchange rates under exchange.conversions module.

Take a look at the example below:

>>> from exchange.conversion import Price, convert
>>> my_price = Price(50, 'USD')
>>> convert(my_price, 'EUR')
<Price(value=Decimal('36.68585000'), currency='EUR')>

Documentation

Coming soon…

Todo

  • Convenient template tags

  • Django price field implementation supporting currency conversions

  • Easier api with convenient refaactorings

  • A few more builtin exchange rate provider

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-exchange-0.7.3.tar.gz (11.6 kB view details)

Uploaded Source

File details

Details for the file django-exchange-0.7.3.tar.gz.

File metadata

File hashes

Hashes for django-exchange-0.7.3.tar.gz
Algorithm Hash digest
SHA256 a6ed1e84f46d3e4dcf34b61ef978e1397e5bb0b8cc9b8bb9b5b59ee0db9c5b93
MD5 25fa575fa0372668cf8fa8591cd0da31
BLAKE2b-256 f8ae5383271c03381d69497f7be2142bd4e670403df98de867cbe3bfd2615978

See more details on using hashes here.

Supported by

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