6👍
✅
date
is a submodule of the datetime
module. You never import a module called date
, so you get a NameError when you try to call it. It should be
import datetime
Date = models.DateField(default=datetime.date.today)
or
from datetime import date
Date = models.DateField(default=date.today)
Source:stackexchange.com