python - Type error "must be string, not datetime.datetime" -


i've got error in view , don't have idea, wrong:

from datetime import datetime  month_dict in finished_by_month:     month_values.append(month_dict['total'])     month_date = datetime.strptime(month_dict['month'], '%y-%m-%d') 

when try see template i've got error:

"must string, not datetime.datetime"

i looking solution, can't find anything. maybe has got similar problem?

assuming error occurring in strptime function, please make sure value referenced month_dict['month'] string , not in date time format. trying convert string time in particular format, value expected compiler string.

for more details on format of time , additional learning, please visit https://docs.python.org/2/library/time.html

note: basis of assumption last line require string format provided whereas above lines not throw particular kind of error.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -