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
Release files for django-exchange 0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-exchange-0.5.tar.gz | 10.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_exchange-0.5-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 23.1 kB
Release files / django-exchange-0.5.tar.gz
| Download URL | django-exchange-0.5.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92c0877c5aa4cb59a7b1e190210d6a49200ee4280100a90b81ebcabfa1c9164e
|
|
BLAKE2b-256 checksum How to use checksums |
1ddc5bed2c6009c64e47a7a797df47c1a69019705ea87af2469e8473a069caf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_exchange-0.5-py2.py3-none-any.whl
| Download URL | django_exchange-0.5-py2.py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ff8001e28e66d0e15fdf2ef88c34c47780958c6af4844c1637bdcfd6e374ae55
|
|
BLAKE2b-256 checksum How to use checksums |
5d981159df03ed051c2ca3781373ba21b232394da783ce3262bb74a0e3b7a4df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |