Description
Some models have blank=True and/or null=True on CharFields. Char fields should almost never allow both null, empty values, and characters, unless there is some unique logic in the backend that is directly dependent on those distinctions.
Reproduction Steps
Steps to reproduce the problem:
Create a recipe type, filling out title
View the recipe to see the generated name field
Edit the recipe and delete the value from title
The recipe type will happily save with an empty title. The name field should never change after the first creation.
Expected behavior
In this case, I don't think title should ever be empty or nullable. I don't know if the backend is specifically looking for nulls or empty strings for some case (maybe some query is actually looking at those values).
Additional context
Additional validation should also be in place in the UI, I'll link that issue next.
Additionally, these models also have a similar situation:
Description Some models have
blank=True
and/ornull=True
onCharField
s. Char fields should almost never allow both null, empty values, and characters, unless there is some unique logic in the backend that is directly dependent on those distinctions.Reproduction Steps Steps to reproduce the problem:
title
name
fieldtitle
The recipe type will happily save with an empty title. The name field should never change after the first creation.
Expected behavior In this case, I don't think
title
should ever be empty or nullable. I don't know if the backend is specifically looking for nulls or empty strings for some case (maybe some query is actually looking at those values).Additional context Additional validation should also be in place in the UI, I'll link that issue next.
Additionally, these models also have a similar situation: