Skip to content

Conversation

Mng-dev-ai
Copy link

Problem

The has_changed method returns True if the value changes from null to "" and vice versa, which is often not what we want

Solution

Added ignore_empty parameter with default value to True to ignore if value changed from null to "" and vice versa

Tests

I will add tests if you agree on the idea of this pr

@Mng-dev-ai Mng-dev-ai force-pushed the ignore-empty-value-when-field-changes branch from dff2f18 to 73d3395 Compare May 26, 2024 13:30
@foarsitter
Copy link
Contributor

Can you describe a use-case where None to empty string shouldn't be an actual change?

To me this sounds a little as https://docs.astral.sh/ruff/rules/django-nullable-model-string-field/

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