django: value has an invalid date format. It must be in YYYY-MM-DD format

后端 未结 1 2282
甜味超标
甜味超标 2021-02-20 15:02

I have a question
I use xpath to get item[\'releaseday\'] from website.
When xpath didn\'t get value

It will cause error :

djang         


        
相关标签:
1条回答
  • 2021-02-20 15:42

    Use item.get('releaseday') or None.

    You'll solve two problems:

    1. When the key does not exist, this will default to None, which is valid input for your model as you have null=True.

    2. If the key exists but its blank '', then it will result in None which is a valid value for your model.

    0 讨论(0)
提交回复
热议问题