0

我以前使用的是 0.6 版本的 django-registration。现在我升级到 0.8,我的 webapp 中出现了一些问题

我在templates/registration文件夹中有注册所需的这些文件(除其他外)

激活_完成.html 激活_email.txt 激活_email_subject.txt 注册_form.html 注册_完成.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中工作..我找不到升级指南中有关模板的任何内容..

任何建议表示赞赏

4

1 回答 1

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

于 2013-01-30T16:07:45.043 回答