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

MonitorField - Change default to None when the field is nullable #599

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

gmcrocetti
Copy link
Contributor

@gmcrocetti gmcrocetti commented Mar 22, 2024

Problem

MonitorField's default value is django.utils.timezone.now even when null=True. This behavior is misleading and should be changed. Despite that, some users might rely on this very same behavior and that's why #577 introduced a deprecation warning when such behavior is encountered.

The goal of this PR is make the field use None as default when initialized with null=True and without a default - of course the provided argument for default takes precedence.

Original discussion in #100

Solution

Remove the deprecation warning introduced in #577 and implement the desired behavior: use None when the field is nullable and no default is provided.

This change requires a major release (5.x.x) as discussed with @foarsitter in #577 .

Commandments

  • Write PEP8 compliant code.
  • Cover it with tests.
  • Update CHANGES.rst file to describe the changes, and quote according issue with GH-<issue_number>.
  • Pay attention to backward compatibility, or if it breaks it, explain why.
  • Update documentation (if relevant).

@foarsitter foarsitter modified the milestones: 4.5.0, 5.0.0 Mar 22, 2024
Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.94%. Comparing base (714632e) to head (952cbe2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #599      +/-   ##
==========================================
- Coverage   98.94%   98.94%   -0.01%     
==========================================
  Files           6        6              
  Lines         760      757       -3     
==========================================
- Hits          752      749       -3     
  Misses          8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@foarsitter
Copy link
Contributor

@gmcrocetti can you rebase this PR? Then I will merge it.

@gmcrocetti
Copy link
Contributor Author

Just did it @foarsitter . Thanks ! :)

@foarsitter foarsitter merged commit 4c9d6ee into jazzband:master Apr 4, 2024
9 checks passed
@foarsitter
Copy link
Contributor

Thanks @gmcrocetti

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

Successfully merging this pull request may close these issues.

2 participants