擅长:python、mysql、java
<p>试试这个</p>
<pre><code>def home(request):
today = datetime.date.today()
# If this is a POST request then process the Form data
if request.method == 'POST':
form = DeadlineForm(request.POST)
# instance = form.save()
currentdate = datetime.date.today()
userinput = form.cleaned_data['date']
or
userinput = request.POST.get('date')
birthday = datetime.datetime.strptime(userinput, '%m/%d/%Y').date()
# print(birthday)
.....
</code></pre>
<p>在userinput中,您没有向strptime函数传递任何值</p>
<p>并使用post方法从表单中获取用户输入</p>