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_exchange_rates

If you want to use you own service provider, you should consider implementing exchange.adapters.BaseAdapter class and pass you implementation class path as an argument to update_exchange_rates command:

$ python manage.py update_exchange_rates -c myproj.providers.MyProvider

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')
>>> my_price.convert('YEN')
<Price (4678.50 YEN)>

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.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

django_exchange-0.7.0-py2.py3-none-any.whl (15.2 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

File hashes

Hashes for django-exchange-0.7.0.tar.gz
Algorithm Hash digest
SHA256 e72f73e6db8260563b8b1dca2b0dccab280eda3b7b19f7a6dc90e6f429d1f425
MD5 9a85504069aff0f5679742dd7cbcc170
BLAKE2b-256 356f1a6ea00d4ff18e62ccc9a9f0061ad4aecc37eb6c51e5ac188f4fb3a71d54

See more details on using hashes here.

File details

Details for the file django_exchange-0.7.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_exchange-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 71308bcf0607e3b22665c5ac3086db0b9ecee657345fcace1d2bbf965a681d66
MD5 7bcb3534db76e236995169ee0c67b151
BLAKE2b-256 e1f7edb154efb0e339375b1db8543cb862536250ce75fbb3af8f464ce1a76977

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