';url';需要非空的第一个参数。Django 1.5中的语法已更改,请参见文档
我正在尝试使用django.contrib.auth登录,但这在django 1.5中似乎不起作用 这是url.py';url';需要非空的第一个参数。Django 1.5中的语法已更改,请参见文档,django,authentication,login,Django,Authentication,Login,我正在尝试使用django.contrib.auth登录,但这在django 1.5中似乎不起作用 这是url.py r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}), 这是我的模板 1 {% extends "website/base.html" %} 2 3 {% block content %} 4 5 {% if form.errors %} 6
r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
这是我的模板
1 {% extends "website/base.html" %}
2
3 {% block content %}
4
5 {% if form.errors %}
6 <p>Authentication error</p>
7 {% endif %}
8
9 <form action="{% url django.contrib.auth.views.login %}" method="post">
10 {% for field in form %}
11 <p>
12 {{ field.label_tag }}: {{ field }}
13 {{ field.errors }}
14 </p>
15 {% endfor %}
16 <p><input type="submit" value="Login" /></p>
17 <input type="hidden" name="next" value="{{ next }}" />
18 </form>
1{%extends“website/base.html”%}
2.
3{%块内容%}
4.
5{%if form.errors%}
6认证错误
7{%endif%}
8.
9
10{表格%中字段的百分比}
11
12{{field.label_tag}}:{{field}
13{{field.errors}}
十四,
15{%endfor%}
16
17
18
如何修复它???您希望在视图名称周围加引号:
<form action="{% url "django.contrib.auth.views.login" %}" method="post">
要在视图名称周围加引号:
<form action="{% url "django.contrib.auth.views.login" %}" method="post">