Git Product home page Git Product logo

Comments (4)

synasius avatar synasius commented on August 17, 2024

Hi @tzenderman

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.

Thnx! I'll love to have your contributions :)

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.

The point here is that I'd like to have two functions: a vanilla convert_money that returns decimal and a specialized function that outputs Money instances. The current convert_money is a base that one can easily wraps, but we should definitely add the specialized version that works with money instances. something like:

def convert_money(money, currency_to):
    # money should be an instance of moneyed.Money
    amount = base_convert_money(money.amount, money.currency.code, currency_to)
    return moneyed.Money(amount, currency_to)

What do you think? Does it work?

I will try to add some basic installation info to the Readme soon, is that ok?

Great! thnx! Also add yourself to contributors in AUTHORS.rst

from django-money-rates.

tzenderman avatar tzenderman commented on August 17, 2024

Awesome!

With respect to the converting money functions, that's exactly what I was thinking. I wasn't sure if you had already wired convert_money into some projects and would break if we made it return a money instance now though. base_convert_money sounds right and I think the convert_money works correctly too. I'll fork, try it out and PR it back soon.

In the project we're using this in, we're updating exchange rates with a celery period_task once a day. I'll see how I can add that as a setting in the repo too as I think it would be super useful...

from django-money-rates.

synasius avatar synasius commented on August 17, 2024

I'll fork, try it out and PR it back soon.

👍

In the project we're using this in, we're updating exchange rates with a celery period_task once a day. I'll see how I can add that as a setting in the repo too as I think it would be super useful...

Yep, would be nice to have such a feature! Keep in mind to put this code in a separate PR. that way it's easier for me to review.

from django-money-rates.

synasius avatar synasius commented on August 17, 2024

this is solved in #3

from django-money-rates.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.