-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
MonitorField
- Change default to None when the field is nullable
#577
MonitorField
- Change default to None when the field is nullable
#577
Conversation
MonitorField
- Change default to None when the field is nullable
We should plan a deprecation path don't you think @gmcrocetti? |
Yes, we should. Is there any major release in the near sight ? |
My cup of tea: A DeprecationWarning when the behavior is encountered and an environment variable to enable the new behavior so we can release 4.5, removing both when 5.0 is released? |
Humm...I initially liked the idea but I'm not so sure after getting my hands dirty. What if we instead split this new behavior in two steps:
I believe it will be better cause we keep the codebase clean and also don't fall into the trap of "remembering" to remove "dead code" added by the feature flag check. WDYT @foarsitter ? |
a57784c
to
bb8ed40
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #577 +/- ##
=======================================
Coverage 98.56% 98.57%
=======================================
Files 6 6
Lines 768 772 +4
=======================================
+ Hits 757 761 +4
Misses 11 11 ☔ View full report in Codecov by Sentry. |
8994d6a
to
b5035b2
Compare
…and no default is provided. The new behavior will be introduced in a next major release
b5035b2
to
22015b8
Compare
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.
Very well @gmcrocetti, perfect solution!
Problem
I recently came across a non-intuitive behavior, IMHO. The MonitorField has its default value set to now even though marked as nullable. Please, I'm open to hearing the opinion case this is expected behavior.
Solution
After catching up the discussion in #100 I decided to implement it. The discussed solution is to set its default value to None when null=True.
If might break backward compatibility at the edge case of someone marking the field as null=True and not expecting default to be None.
Commandments
CHANGES.rst
file to describe the changes, and quote according issue withGH-<issue_number>
.