mirumee/django-prices-openexchangerates

Name: django-prices-openexchangerates

Owner: Mirumee Labs

Description: openexchangerates.org support for django-prices

Created: 2015-01-27 10:10:35.0

Updated: 2018-04-11 06:32:01.0

Pushed: 2018-03-20 13:10:27.0

Homepage: null

Size: 114

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

openexchangerates.org support for django-prices

 prices import Money
 django_prices_openexchangerates import exchange_currency

erted_price = exchange_currency(Money(10, currency='USD'), 'EUR')
t(converted_price)
ney('8.84040', currency='EUR')

It will also create additional steps if it cannot convert directly:

 prices import Money
 django_prices_openexchangerates import exchange_currency

erted_price = exchange_currency(Money(10, currency='GBP'), 'EUR')
t(converted_price)
ney('13.31313588062401085236264978', currency='EUR')

The exchange_currency supports Money, TaxedMoney, MoneyRange and TaxedMoneyRange.

Template filters can be used with django-prices to convert currency, round amounts and display localized amounts in templates:

oad prices_i18n %}
oad prices_multicurrency %}

rice: {{ foo.price.gross|in_currency:'USD'|amount }} ({{ foo.price.net|in_currency:'USD'|amount }} + {{ foo.price.tax|in_currency:'USD'|amount }} tax)</p>

Installation

First install the package:

install django-prices-openexchangerates

Then add 'django_prices_openexchangerates' to your INSTALLED_APPS.

Set following settings in your project's settings:

Use your admin console to create ConversionRate objects for each currency that you want to support.

Updating exchange rates

Fetch current rates from API with ./manage.py update_exchange_rates

Schedule this task in cron job or in celery, to be always up to date with exchange rates

You can use --all flag in above command, to create exchange rates automatically for all available currencies.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.