Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose/Motivation
It's a common issue to have
null=True
or adefault_value
withoutblank=True
on a field in a django model. This causes a conflict in forms, which interprets the field asrequired
even though you intend for the value to benull
or thedefault_value
set on the field. In my case, I was trying to clear out thewebhook_secret
field, but my changes were blocked because thewebhook_secret
cannot be blank, therefore there was no way to get it back to thenull
value I wanted, which is allowed in the database.Links to relevant tickets
part of https://github.com/codecov/internal-issues/issues/366
What does this PR do?
I need to be able to delete the webhook_secret, this was not allowed by the form. These changes allow me to clear out that field, fixed it on a few other fields on the model as well so that it behaves closer to how we intended.