-
Notifications
You must be signed in to change notification settings - Fork 136
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
Boolean field preventing model to be saved #56
Comments
I'm not completely sure this will fix your problem, but it may.
|
Adding blank=True was not changing anything. I temporarily solved the problem by changing the booleanField for a charField with choices "true" or "false" and putting null=True, blank=False. It forces the user to pick either true or false which aren't default values and therefore guarantees that the level 2 model will be saved. But ideally there should be a mechanism in place for the level 2 model to be saved if it is referred to in a level 3 model. |
Thank you so much for your response! Even after 8 years 😅 OK, how can we make a PR to fix this? |
I am trying to save a model with a boolean field at level 2.
`class Level2(models.Model):
id = models.AutoField(primary_key=True)
level1 = models.ForeignKey(Level1, blank=True, null=True)
is_correct = models.BooleanField(default=False)
class Level3(models.Model):
id = models.AutoField(primary_key=True)
type = models.CharField(max_length = 50, blank=True, null=True)
level2 = models.ForeignKey(Level2, blank=True, null=True)`
if the default value of the boolean field (false here but same when true) is kept, this leads to the following error:
however once the model has been saved i can change the value of the field without any problem.
Is this a bug or am I missing something?
The text was updated successfully, but these errors were encountered: