我之前使用的是django -registration的0.6版本。现在我已升级到0.8,并且我的webapp中出现了一些问题
我在templates/registration
文件夹中,注册所需的这些文件(以及其他文件)
activation_complete.html activation_email.txt activation_email_subject.txt registration_form.html registration_complete.html
registration_form.html是
{% extends "registration/auth_base.html" %}
{% block content %}{{block.super}}
<div class="subtitle short">Register</div>
<div id="registerform" class="box half">
<form action="/myapp/account/register/" method="POST">{% csrf_token %}
{% if form.non_field_errors %}
{{ form.non_field_errors }}
{% endif %}
<fieldset class="registerfields">
<p><label for="id_username">Username:</label> {{ form.username }}</p>
{% if form.username.errors %}<p class="error">{{ form.username.errors }}</p>{% endif %}
<p><label for="id_email">EmailAddress:</label>{{ form.email }}</p>
{% if form.email.errors %}<p class="error">{{ form.email.errors }}</p>{% endif %}
<p><label for="id_password1">Password:</label>{{ form.password1 }}</p>
{% if form.password1.errors %}<p class="error">{{ form.password1.errors }}</p>{% endif %}
<p><label for="id_password2">Password(again):</label>{{ form.password2 }}</p>
{% if form.password2.errors %}<p class="error">{{ form.password2.errors }}</p>{% endif %}
<p>
<input type="submit" value="Submit" />
</p>
</fieldset>
</form>
</div>
{% endblock %}
模板registration_complete.html如下所示
{% extends "registration/auth_base.html" %}
{% block content %}{{block.super}}
<p id="message">Registration Complete! Check your email</p>
{% endblock %}
此处还有auth_base.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Myapp{% block title %} {% endblock %}</title>
<LINK REL=StyleSheet HREF="{{MEDIA_URL}}css/myapp.css" TYPE="text/css" MEDIA="screen, print"/>
<link rel="shortcut icon" href="{{ MEDIA_URL }}img/myapp-icon.ico"/>
</head>
<body>
<div id="content">
{% block content %}
{% endblock %}
</div>
<div id="sidebar">
<h3> page info </h3>
{% block whatis %}
{% endblock %}
</div>
<div id="homelnk">
<a href="{% url home %}"><img class="centerpage" src="{{ MEDIA_URL }}img/home.png"></a>
</div>
</body>
</html>
但是当我提交新的用户注册详细信息时,我没有收到此registration_complete页面。我仍然会收到一个包含空白字段的注册表单
仍然,激活链接被发送到电子邮件,我能够以新用户身份登录。为什么没有显示registration_complete页面?这曾经用于旧版本的django-registration ..我不能在升级指南中找不到有关模板的任何内容..
任何建议表示赞赏
答案 0 :(得分:1)
我将此模板用于registration_form.html:
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<form method="post" action=".">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}
你可以在这里找到更多这些: https://github.com/nathanborror/django-registration/tree/master/registration/templates/registration