Search code examples
pythondjangodjango-registration

django-registration simple backend setup


I'm trying to add django-registration to the tutorial application in the django docs, using the simple backend.

So far, I included the URLconf registration.backends.simple.urls, like so:

from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    url(r'^polls/',     include('polls.urls')),
    url(r'^admin/',     include(admin.site.urls)),
    url(r'^accounts/',  include('registration.backends.simple.urls')),
    )

What do I do next? Also, which templates are required for the simple backend, as opposed to the default backend?


Solution

  • For template, create a folder name "registration" in your template folder.

    Then create a file for each registration action :

    • registration/registration_form.html : registration form
    • registration/activate.html : activation page
    • registration/activation_complete.html : activation complete
    • registration/registration_complete.html : registration complete
    • registration/registration_closed.html : disabllowed registration

    For registration form page, django return form model in variable name's "form". You can call it in your template like this :

    <form action="/accounts/register/" method="post">
      {% csrf_token %}
      {{ form.as_p }}
      <input type="submit" value="Submit" />
    </form>