Python 3.x 字典更新序列元素#0的长度为1;2是必需的。模板呈现期间出错
以前有人问过这个问题,但给出的答案似乎不适合我。。。我有:Python 3.x 字典更新序列元素#0的长度为1;2是必需的。模板呈现期间出错,python-3.x,django-urls,django-1.8,django-1.11,Python 3.x,Django Urls,Django 1.8,Django 1.11,以前有人问过这个问题,但给出的答案似乎不适合我。。。我有: ValueError at /myapp/ dictionary update sequence element #0 has length 1; 2 is required Error during template rendering In template ~/Software/myproject/myapp/templates/myapp/base.html, error at line 53 dictionary upda
ValueError at /myapp/
dictionary update sequence element #0 has length 1; 2 is required
Error during template rendering
In template ~/Software/myproject/myapp/templates/myapp/base.html, error at line 53
dictionary update sequence element #0 has length 1; 2 is required
base.html
<a class="brand" href="{% url "about" %}">About page</a>
视图.py
def idx_order(request):
orders = Order.objects.all().order_by('status','deadline','created','lastUpdate').exclude(status=2)
orders_done = Order.objects.all().order_by('status','deadline','created','lastUpdate').filter(status=2)
return render(request, 'myapp/index_other.html', {
'orders': orders,
'orders_done': orders_done,
'STATUS_CHOICES': dSTATUS_CHOICES
})
def about(request):
"""
Function outputs user and system credentials to an about.html page depending on whether DEBUG = True/False.
"""
if settings.DEBUG == True:
do stuff
return render(request, 'myapp/about.html',
{'list_zero': list_zero,
'list_one': list_one,
'installed_packages_list': library_dict
})
else:
return HttpResponse("You shouldn't be here :o)")
urlpatterns = [
url(r'^$', idx_order, name='idx_order'),
url(r'^about/$', about, name='about'),
url.py
def idx_order(request):
orders = Order.objects.all().order_by('status','deadline','created','lastUpdate').exclude(status=2)
orders_done = Order.objects.all().order_by('status','deadline','created','lastUpdate').filter(status=2)
return render(request, 'myapp/index_other.html', {
'orders': orders,
'orders_done': orders_done,
'STATUS_CHOICES': dSTATUS_CHOICES
})
def about(request):
"""
Function outputs user and system credentials to an about.html page depending on whether DEBUG = True/False.
"""
if settings.DEBUG == True:
do stuff
return render(request, 'myapp/about.html',
{'list_zero': list_zero,
'list_one': list_one,
'installed_packages_list': library_dict
})
else:
return HttpResponse("You shouldn't be here :o)")
urlpatterns = [
url(r'^$', idx_order, name='idx_order'),
url(r'^about/$', about, name='about'),
我正在执行从Django1.8到1.11的更新。我为此绞尽脑汁,但看不出我的错误在哪里