Search code examples
django-registrationdjango-1.10

Django-Registration-Redux doesn't see my templates/registration templates


I am using Django 1.10. Technically this post is regarding Django-registration-redux but SO wouldnt let me create a new tag to post the question. Django-registration-redux doesnt see the registration templates. I copied all the templates into a folder called "registration" inside of my templates folder. I dont get an error though. For example, when I go to /accounts/register it renders some form but it isn't the one from my templates/register folder. Im not sure what I am doing wrong. I have even gone as far as to delete the templates/registration folder entirely and I dont even get an error. I read some similar posts where people had to move the registration to the top of the installed apps so it wouldnt use the admin forms which I tried and didnt help. So far nothing has changed. All the templates do extend base.

So Im guessing I have configured something wrong. It's weird. All the functionality is there but its just not using my templates. Sorry if its a dumb question but I would appreciate some help!

pip freeze
Django==1.10
django-crispy-forms==1.6.0
django-registration-redux==1.4

INSTALLED_APPS = [
    'registration',
    'django.contrib.admin',
    'django.contrib.sites',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # third party
    'crispy_forms',
    # my apps
    'todo',
]



# Django registration redux settings
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_OPEN = True
REGISTRATION_AUTO_LOGIN = True
LOGIN_REDIRECT_URL = '/'  # The page you want users to arrive at after they successful log in
LOGIN_URL = '/accounts/login/'

SITE_ID = 1

Here is my /templates/registration/registration_form.html

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

{% block content %}
<div class='row'>
<div class='col-sm-6 col-sm-offset-3'>
<h1>Register for free!</h1>
<form method="post" action=".">
  {% csrf_token %}
  {{ form|crispy }}

  <input class='btn btn-block btn-primary' type="submit" value="{% trans 'Join' %}" />
</form>
</div>
</div>

<hr/>
<div class='row'>
<div class='col-sm-6 col-sm-offset-3 text-align-center'>
<p>Need to <a href="{% url 'auth_login' %}">Login</a>?</p>
</div>
</div>

{% endblock %}

this is a screenshot showing the form I see at accounts/register


Solution

  • In settings.py you have to place your app above the 'registration' app. It seems the order the apps are listed in the settings.py file determines which templates are being used.