How To Use Null Values In Django Model Fields
While I was looking django framework I need to add some fields to the model class but because of I have migrated current class and saved some value for this model django gives warning like this.
You are trying to add a non-nullable field ‘type’ to word without a default; we can’t do that (the database needs something to populate existing rows).
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows)
2) Quit, and let me add a default in models.py
Here I can some options to choose bu I want to cope with that by using field option like null. null option like you see the syntax below gives ability to set current field null value. This is where old records new fields will be.
language = models.CharField(max_length=2,null=True)