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
Better default setup on MoneyField
for models
#661
Conversation
Codecov Report
@@ Coverage Diff @@
## main #661 +/- ##
=======================================
Coverage 97.79% 97.80%
=======================================
Files 29 29
Lines 997 1001 +4
Branches 196 197 +1
=======================================
+ Hits 975 979 +4
Misses 15 15
Partials 7 7
Continue to review full report at Codecov.
|
I'm not sure why CI runs with |
I think the closest I got to is somewhere here: https://stackoverflow.com/questions/65476852/make-pypy-in-virtualenv-use-shared-library-from-os-rather-than-its-own-copy-lib No idea if deleting PyPy's copies of |
@Stranger6667 any insight on why running with Additionally, there's an odd error (new to me at least) on the |
48f1f25
to
bf9dcf8
Compare
Seems that it was fixed with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid work 💯
If @Stranger6667 isn't around for another review, I'll get it in within the next days - meanwhile, release notes for this are more than welcome :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pinging me @benjaoming :)
I have a small comment on one of the error messages
- Removes possibility of allowing _any_ currency code on string based default value - Having a default as type `bytes` is now properly supported - Asserts on incompatible defaults with default currency being `None` when amount has a valid type (i.e. a default setup generating `Money(10, None)`) - Turns off coverage reporting when test run failed
6dcdbeb
to
08ce86e
Compare
Thanks for the patience @flaeppe 🙏 ⏳ 🚀 |
Hi, I was digging in to making some progress on #638 (refs: #621) and realised that there was some adjustments that could be made for defaults on
djmoney.models.fields.MoneyField
. I've gathered several (minor) fixes in this PR(see list below), all of them originating from the same method.bytes
is now properly supportedNone
when amount has a valid type (i.e. a default setup generatingMoney(10, None)
)I think the changes here pushes work for #638 at least a little bit forward, as one of the major changes there would (probably?) be setting
DEFAULT_CURRENCY=None
per default. While the changes here help out on management ofMoneyField(..., default_currency=None)
. And I was thinking it could be nice taking the opportunity helping reduce the size of the work on #638.Anyways, let me know what you think.