I have a model which already has multiple records. I now need to add a DateTimeField while giving a specific date as default for all the existing records of the model
in my model, I'm trying to do:
import datetime
class some_model:
**some fields here**
setup_date = models.DateTimeField(default = datetime.datetime(2020,1,1))
on running makemigrations and migrate I do not get any error but the field does not get added to the database
I've also tried with a callback function as follows
def default_datetime_for_my_class():
return datetime.datetime(1900,1,1)
class some_model:
**some fields here**
setup_date = models.DateTimeField(default = default_datetime_for_my_class)