using django-registration form instead of own
<p>So I am using <code>django-registration</code> for email activation and the like. I defined my form and am calling to it properly however for some reason it is using the base form out of <code>django-registration</code> instead of my own. I have absolutely no clue as to why this is happening, any thoughts?</p>

<p>views.py</p>

<pre><code>from django.shortcuts import render, render_to_response
from django.http import HttpResponseRedirect
from django.template.context_processors import csrf
from django.contrib.auth.models import User
from .forms import UserForm


def register(request):
    if request.method == 'POST':
        form = UserForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/accounts/register/complete')

    else:
        form = UserForm()
        token = {}
        token.update(csrf(request))
        token['form'] = form

    return render('registration/registration_form.html', token)

def registration_complete(request):
    return render('registration/registration_complete.html')
</code></pre>

<p>urls.py</p>

<pre><code>from django.conf.urls import include, url
from django.contrib import admin
from main import views

urlpatterns = [

    # Registration URLs
    url(r'^accounts/', include('registration.backends.hmac.urls')),
    url(r'^accounts/register/$', views.register, name='register'),
    url(r'^accounts/register/complete/$', views.registration_complete, name='registration_complete'),

    url(r'^admin/', admin.site.urls),
    url(r'^$', views.index, name='index'),
    url(r'^contact/$', views.contact, name='contact'),
    url(r'^login/$', views.login, name='login'),
    url(r'^register/$', views.register, name='register'),
    url(r'^profile/$', views.profile, name='profile'),
    url(r'^blog/$', views.blog, name='blog'),
</code></pre>

<p>forms.py</p>

<pre><code>from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from django.utils.translation import gettext as _
from registration.forms import RegistrationFormUniqueEmail, RegistrationForm

class UserForm(UserCreationForm):

    email = forms.EmailField(required=True)
    first_name = forms.CharField(label=_("Firstname"), required=False)
    last_name = forms.CharField(label=_("Lastname"),  required=False)

    class Meta:
        model = User
        fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2')

    def save(self, commit=True):
        user = super(UserForm, self).save(commit=False)
        user.first_name = self.cleaned_data['first_name']
        user.last_name = self.cleaned_data['last_name']
        user.email = self.cleaned_data['email']

        if commit:
            user.save()

        return user
</code></pre>

<p>template</p>

<pre><code>{% extends "base.html" %}
{% block title %}Register{% endblock %}
{% block content %}

  &lt;h2&gt;Registration&lt;/h2&gt;

  &lt;form action="/accounts/register/" method="post"&gt;{% csrf_token %}
    {{ form.as_p }}
  &lt;input type="submit" value="Register" /&gt;

  &lt;/form&gt;

{% endblock %}
</code></pre>

<p>Since <code>urlpatterns</code> has that order:</p>

<pre><code>url(r'^accounts/', include('registration.backends.hmac.urls')),
url(r'^accounts/register/$', views.register, name='register'),
url(r'^accounts/register/complete/$', views.registration_complete, name='registration_complete'),
</code></pre>

<p>Url from <code>url(r'^accounts/', include('registration.backends.hmac.urls')),</code> match your <code>/accounts/register/</code> url first, and don't get to your <code>views.register</code> view. So, to change that, you need to change the order, so that url patterns would be</p>

<pre><code>urlpatterns = [
    url(r'^accounts/register/$', views.register, name='register'),
    url(r'^accounts/register/complete/$', views.registration_complete, name='registration_complete'),
    url(r'^accounts/', include('registration.backends.hmac.urls')),
    ...
    ]
</code></pre>

python django forms django-registration