1👍
✅
Check all your imports. If you import in models like
from datetime import datetime
and then import
from .models import *
so you will have errors like this. Check all your imports.
0👍
Try this:
import datetime
for i in range(int(cac)):
print (datetime.datetime.now() - datetime.timedelta(minutes=i)).strftime('%Y-%m-%d %H:%M')
Source:stackexchange.com