evonove / django-money-rates Goto Github PK
View Code? Open in Web Editor NEWCurrency conversion for django money
License: BSD 3-Clause "New" or "Revised" License
Currency conversion for django money
License: BSD 3-Clause "New" or "Revised" License
After merging pull request #3 new dependency in file utils.py has been created:
import moneyed
A reason why modules were messed up is not clear. There was two independent modules moneyed for storing money type and djmoney_rates for money convertation.
If someone wants to use these modules together - why not, but there are no needs to inject one into another.
By pull request #3 was implemented one particular usage case of this module. This is not right and breaks module structure.
CC: @tzenderman
If this is library is no longer supported, which it looks like it mightn't be, a notice on the README would be useful. Especially considering this library is recommended by https://github.com/django-money/django-money which is currently supported.
For others reading, issues I ran into trying to get this to work this afternoon in Django 1.10:
INSTALLED_APPS
and even chucked the import
in, but nada, doesn't seem to show upI am going to look for alternatives at this point as I'm getting all of the smells that I shouldn't be using this.
When using in Django 1.9 one can get:
ImportError: cannot import name importlib
django.utils.importlib
was deprecated for Django 1.9
Hello,
I installed this package as instructed via pip. Any attempt to use the example method or update currency produces the following:
django.db.utils.ProgrammingError: relation "djmoney_rates_ratesource" does not exist
LINE 1: ..., "djmoney_rates_ratesource"."base_currency" FROM "djmoney_r..
Specs:
Windows 7
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Django 1.8.2
py-moneyed 0.5.0
djmoney_rates/models.py Line 21 needs to be changed from
source = models.ForeignKey(RateSource)
to
source = models.ForeignKey(RateSource, on_delete=models.CASCADE)
Thanks
Following errors retrieved when running python manage.py update_rates
CommandError: Error during rate update: relation "djmoney_rates_ratesource" does not exist
LINE 1: ..., "djmoney_rates_ratesource"."base_currency" FROM "djmoney_r...
Updated settings.py to use the standard importlib since django.utils.importlib has been removed in 1.9.
#9
Using Django 1.9 and Python 2.7.
I have run migration after performing the quick start and setting up environment, no error found and it run successfully. Verified in postgres DB, the said table "djmoney_rates_ratesource" is not created.
Any help would be appreciated!
Using python 3.3.3 and django 1.6, I get the following error when attempting to update rates:
$ python manage.py syncdb
Creating tables ...
Creating table djmoney_rates_ratesource
Creating table djmoney_rates_rate
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
$ python manage.py update_rates
CommandError: Error during rate update: Error retrieving rates: can't use a string pattern on a bytes-like object
Hey!
Very nice work on this repo, I'm integrating it now to my project and want to contribute back to the repo soon as well.
With regards to the djmoney_rates.utils.convert_money
function, is there a reason it returns a Decimal
and not a Money
instance? I can always create another util that will return the money instance the way I am thinking, but let me know.
I will try to add some basic installation info to the Readme soon, is that ok?
-Tim
Hi, I'm just upgrading dependencies in one of my project, I notice the function currencies.utils.calculate_price
is gone, I used to use this to do some currency conversion in a backend process.
I have tracked the deletion up to this commit 39b785a, and I notice there's now a currencies.utils.calculate
is that the same function that just got renamed? The commit message isn't helpful at all, it doesn't explain the changes that were made.
Thanks for the help!
Thanks for maintaining this package, it's great. Would it be possible to get the PyPi version updated? I was getting an error that was due to an incompatibility with Django 1.10, which has since been fixed in the master branch. I'm currently pip installing from master, which has fixed my issue, but it looks like the latest version of this package on PyPi is from 2014-01-12 -- would it be possible to get a new package and version up on there?
Thanks!
Currently at least 2 database queries are performed for each currency conversion. This means that using django-money-rates for some tasks becomes infeasible, for example converting a large number of money amounts into a canonical currency so that they can be sorted according to true value.
With the current setup where rates are updated via a cronjob I don't think there would be a particular disadvantage in caching the results for 60s however possibly a more robust solution would be to use a configurable rates source backend which could be over-ridden to allow someone to add whatever caching logic they require.
At the moment I'm simply monkey patching the relevant functions:
djmoney_rates.utils.get_rate = memoize(djmoney_rates.utils.get_rate)
djmoney_rates.utils.get_rate_source = memoize(djmoney_rates.utils.get_rate_source)
Let me know if you have any thoughts or questions.
Thanks,
Mike
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.