Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting NULL values into both the price and price_currency associated field into the database when inserting an empty Money() value? #746

Open
swiss-knight opened this issue Jan 18, 2024 · 0 comments

Comments

@swiss-knight
Copy link

Hello,

I'm facing an error when trying to insert an empty Money value (corresponding to a MoneyField in my model) into a PostgreSQL database. The field value is set as: "price_field": None

Here is the error:

django.db.utils.DataError: value too long for type character varying(3)

So I also tried to set it to an empty money object: "price_field": Money() but then it raises:

TypeError: __init__() missing 1 required positional argument: 'currency'

The same error occurs when trying to use "price_field": Money(None,None).

Hence my question: how to correctly set a NULL into both the price and price_currency associated field into the database when inserting an empty Money() value?

Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant