這裏開始使用Django 1.3。目前爲止熱愛這個系統,但是在努力工作。也喜歡Q & As的stackoverflow作爲。 :)帶有django.contrib.auth.views.login的TemplateSyntaxError
我目前正在努力獲取登錄&註冊工作,我得到一個TemplateSyntaxError與我的登錄視圖。
Template error
In template /templates/login.html, error at line 9 Caught SyntaxError while rendering: ('invalid syntax', ('/userProfile/views.py', 47, 52, "\t\treturn render_to_response('login.html', {'form': })\n"))
我複製粘貼從Django的權威性文件的代碼登錄的看法:
{% extends "base.html" %}
{% load url from future %}
{% block body-content %}
{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
<form method="post" action="{% url django.contrib.auth.views.login %}">
{% csrf_token %}
<table>
<tr>
<td>{{ form.username.label_tag }}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{{ form.password.label_tag }}</td>
<td>{{ form.password }}</td>
</tr>
</table>
<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
{% endblock %}
Django是以下行打破 -
<form method="post" action="{% url 'django.contrib.auth.views.login' %}">
我試着刪除單引號,添加引號,刪除未來的網址加載,但似乎沒有任何工作。我讀過NoReverseMatch question,但它似乎並不適用。
它說你有你'views.py'錯誤?有SyntaxError,而不是NoReverseMatch。 – demalexx 2012-01-04 04:03:02