Skip to content

altimore/django-currency-rates

Repository files navigation

django-currency-rates

Notes

This is a fork from the original project to use recent django and python3

OpenExchange

Django currencies and exchange rates for django projects

You need a key from http://openexchangerates.org/ to get the echange rates

exchangeratesapi.io

Same here https://exchangeratesapi.io/documentation/

Features

  • Currencies and exchange rates models
  • Exchange rates with diferent rates for diferent dates
  • Load automatically currencies and rates from http://openexchangerates.org/

Installation

if installed remove the previous version poetry remove uninstall django-currency_rates

  1. poetry git+https://github.com/altimore/django-currency-rates/
  2. Add "currency_rates" to the INSTALLED_APPS tuple found in your settings file.
  3. Add OPENEXCHANGERATES_APP_ID to your setting file with an app key from http://openexchangerates.org/
  4. Run manage.py migrate
  5. Run manage.py load_currencies to load currencies from http://openexchangerates.org/
  6. Run manage.py load_rates to load current exchange rates from http://openexchangerates.org/

Add to your settings.py : EXCHANGERATESAPIIO_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Extra

If you use django-select2 you can use the widgets as follow :

```

from companies.widgets import OrganizationWidget from currency_rates.widgets import CurrencyWidget

class BankAccountForm(forms.ModelForm):
class Meta:

model = BankAccount fields = "__all__" widgets = {

"company": OrganizationWidget, "bank": OrganizationWidget, "currency": CurrencyWidget,

}

```

Testing if it works

poetry run python -m currency_rates.converters.__init__ or individually by converter name

Updating the code

Make your changes, commit these, then run poetry run cz bump --changelog to update the changelog and bump the version number. Then git push to send to the server.