Could anyone help me solve this problem?
I want to add data and time models in Django, but after makemigration, I got this.
**You are trying to add a non-nullable field ‘MeterReading_DateTime’ to mdm_api without a default; we can’t do that (the database needs something to populate existing rows).
Please select a fix:
- Provide a one-off default now (will be set on all existing rows with a null value for this column)
- Quit, and let me add a default in models.py
Select an option:**
Because it is a non-nullable field, It needs a default value to be set if there is a row without a value for that column.
The first point means, for the existing records, it will add a value for this field.
The second point means, you have to give a default value which will be used for the existing records and also for the future records (unless you change it)
Either you add a null=True, give it a one-off default value, or add a default value in your model
Answered By – Basant kumar Bhala