django-model-utils icon indicating copy to clipboard operation
django-model-utils copied to clipboard

Allows nullable MonitorField to be populated on creation

Open FranciscodeMaussion opened this issue 7 months ago • 0 comments

Problem

Monitor field does not gets populated on creation since the previous != current evaluates to False. The problem is when when is setted and not respected on creation. Related issues:

  • https://github.com/jazzband/django-model-utils/issues/401
  • https://github.com/jazzband/django-model-utils/issues/352

Solution

Now 2 checks are done:

  • when is None we use previous != current
  • when is not None:
  • we use previous != current and check if current in when
  • (change here) check if is add and current in when

Commandments

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

FranciscodeMaussion avatar Sep 26 '25 14:09 FranciscodeMaussion