[Django]-Descriptor 'date' requires a 'datetime.datetime' object but received a 'unicode'

10๐Ÿ‘

โœ…

By using from datetime import datetime, timedelta you have imported the datetime type from the datetime module. Thus when you call datetime.date you are calling a method on the datetime type.

I think what you want is to use the date type from the datetime module:

  1. Change your import to from datetime import datetime, timedelta, date.
  2. Call date(year, month, 1) instead of datetime.date(year, month, 1).
๐Ÿ‘คBrenBarn

Leave a comment