Onyilimba
Onyilimba

Reputation: 1217

Change price field according to exchange rate django

is there anyway to change price field dynamically according to the days exchange rate of dollar? in django?? Example:

class Sales(models.Model):
    price = models.DecimalField()
""" other codes goes in here """

Upvotes: 2

Views: 831

Answers (1)

William Colmenares
William Colmenares

Reputation: 148

You can build a simple api to look up the exchange rate, for example, this one gives the exchange rates every 30 minutes (no registration needed).

http://free.currencyconverterapi.com/api/v5/convert?q=EUR_USD&compact=y

It would be dynamically, and no a fixed price rate conversion.

i know there are some limitations, but it could work if you're on a small project, otherwise, you would scrape some data from other pages using beautiful soup.

Upvotes: 2

Related Questions