Search code examples
djangoregistrationdjango-registration

Registration templates not overriding registration view


I have setup registration in my Django app using Django-Registration-Redux and it has been working great until I have thought about styling my pages.

I was under the impression that I was using a series of default templates for registration/authentication stored here:

proj
|
|-- proj
|
|-- app
     |
     |--templates
           |
           |-- app
           |
           |-- registration
                     |
                     |-- login.html
                     |
                     |-- logout.html
                     |
                     |-- ...

However, what ever changes I have begun to make to these templates does not reflect on my site which makes me think I am not overriding the default build in views. Am I putting these in the correct location? Anything else I would need to do?

My login.html view is as follows:

{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block content %}

    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
        Login
        </h1>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class='row'>
            <div class='col-sm-6 col-sm-offset-3'>
                <h1>Login</h1>
                <form method="post" action=".">
                    {% csrf_token %}
                    {{ form|crispy }}
                    <input class='btn btn-block btn-primary' type="submit" value="{% trans 'Submit' %}" />
                    <input type="hidden" name="next" value="{{ next }}" />
                </form>
            </div>
        </div>
        <hr/>
        <div class='row'>
            <div class='col-sm-6 col-sm-offset-3 text-align-center'>
                <p>{% trans "Forgot password" %}? <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a>!</p>
                <p>{% trans "Not member" %}? <a href="{% url 'registration_register' %}">{% trans "Register" %}</a>!</p>
            </div>
        </div>
    </section>

{% endblock %}

Solution

  • If your template folder is called regsitration instead of registration than this would be an easy solution to your problem ;-)

    Otherwise your solution seems correct. Note that if you wish, you could change your login template in the global url configuration. See https://docs.djangoproject.com/en/1.9/topics/auth/default/#all-authentication-views for details. For the logout view, the default template resides in registration/logged_out.html (as this redirects to the page after you log out).