]> git.ozlabs.org Git - patchwork/commitdiff
Use django-registration infrastructure
authorJeremy Kerr <jk@ozlabs.org>
Fri, 22 Aug 2008 02:41:25 +0000 (10:41 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Fri, 22 Aug 2008 02:41:25 +0000 (10:41 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
35 files changed:
apps/patchwork/forms.py
apps/patchwork/models.py
apps/patchwork/urls.py
apps/patchwork/utils.py
apps/patchwork/views/base.py
apps/patchwork/views/patch.py
apps/patchwork/views/user.py
apps/registration [new symlink]
apps/settings.py
apps/urls.py
templates/base.html [new file with mode: 0644]
templates/patchwork/base.html [deleted file]
templates/patchwork/bundle-public.html
templates/patchwork/bundle.html
templates/patchwork/list.html
templates/patchwork/login.html [deleted file]
templates/patchwork/logout.html [deleted file]
templates/patchwork/patch.html
templates/patchwork/profile.html
templates/patchwork/project.html
templates/patchwork/projects.html
templates/patchwork/register-confirm.html [deleted file]
templates/patchwork/register.html [deleted file]
templates/patchwork/register.mail
templates/patchwork/todo-list.html
templates/patchwork/todo-lists.html
templates/patchwork/user-link-confirm.html
templates/patchwork/user-link.html
templates/registration/activate.html [new file with mode: 0644]
templates/registration/activation_email.txt [new file with mode: 0644]
templates/registration/activation_email_subject.txt [new file with mode: 0644]
templates/registration/login.html [new file with mode: 0644]
templates/registration/logout.html [new file with mode: 0644]
templates/registration/registration_complete.html [new file with mode: 0644]
templates/registration/registration_form.html [new file with mode: 0644]

index a758d462359a8502fc4b401c3198a2dce001af8b..7adc8c062b0a1fd92aa7941d09aaece31c36a303 100644 (file)
 from django.contrib.auth.models import User
 from django import forms
 
 from django.contrib.auth.models import User
 from django import forms
 
-from patchwork.models import RegistrationRequest, Patch, State, Bundle, \
-         UserProfile
-
-class RegisterForm(forms.ModelForm):
-    password = forms.CharField(widget = forms.PasswordInput)
-    email = forms.EmailField(max_length = 200)
-
-    class Meta:
-        model = RegistrationRequest
-        exclude = ['key', 'active', 'date']
-
-    def clean_email(self):
-        value = self.cleaned_data['email']
-        try:
-            User.objects.get(email = value)
-            raise forms.ValidationError(('The email address %s has ' +
-                    'has already been registered') % value)
-        except User.DoesNotExist:
-            pass
-        try:
-            RegistrationRequest.objects.get(email = value)
-            raise forms.ValidationError(('The email address %s has ' +
-                    'has already been registered') % value)
-        except RegistrationRequest.DoesNotExist:
-            pass
-        return value
-
-    def clean_username(self):
-        value = self.cleaned_data['username']
-        try:
-            User.objects.get(username = value)
-            raise forms.ValidationError(('The username %s has ' +
-                    'has already been registered') % value)
-        except User.DoesNotExist:
-            pass
-        try:
-            RegistrationRequest.objects.get(username = value)
-            raise forms.ValidationError(('The username %s has ' +
-                    'has already been registered') % value)
-        except RegistrationRequest.DoesNotExist:
-            pass
-        return value
+from patchwork.models import Patch, State, Bundle, UserProfile
+from registration.forms import RegistrationFormUniqueEmail
+from registration.models import RegistrationProfile
+
+class RegistrationForm(RegistrationFormUniqueEmail):
+    first_name = forms.CharField(max_length = 30, required = False)
+    last_name = forms.CharField(max_length = 30, required = False)
+    username = forms.CharField(max_length=30, label=u'Username')
+    email = forms.EmailField(max_length=100, label=u'Email address')
+    password = forms.CharField(widget=forms.PasswordInput(),
+                                label='Password')
+    password1 = forms.BooleanField(required = False)
+    password2 = forms.BooleanField(required = False)
+
+    def save(self, profile_callback = None):
+        user = RegistrationProfile.objects.create_inactive_user( \
+                username = self.cleaned_data['username'],
+                password = self.cleaned_data['password'],
+                email = self.cleaned_data['email'],
+                profile_callback = profile_callback)
+        user.first_name = self.cleaned_data.get('first_name', '')
+        user.last_name = self.cleaned_data.get('last_name', '')
+        user.save()
+        return user
+
+    def clean(self):
+        return self.cleaned_data
 
 class LoginForm(forms.Form):
     username = forms.CharField(max_length = 30)
 
 class LoginForm(forms.Form):
     username = forms.CharField(max_length = 30)
index e3fc9c7e1f7b068e0bb176c8d83ac35fb8d1873a..a40931aa1c3af6f7079dcc761f310bf2df9b8c91 100644 (file)
@@ -129,43 +129,6 @@ def _confirm_key():
         str += random.choice(allowedchars)
     return str;
 
         str += random.choice(allowedchars)
     return str;
 
-class RegistrationRequest(models.Model):
-    username = models.CharField(max_length = 30, unique = True)
-    first_name = models.CharField(max_length = 50)
-    last_name = models.CharField(max_length = 50)
-    email = models.CharField(max_length = 200, unique = True)
-    password = models.CharField(max_length = 200)
-    key = models.CharField(max_length = 32, default = _confirm_key)
-    date = models.DateTimeField(default=datetime.datetime.now)
-    active = models.BooleanField(default = True)
-
-    def create_user(self):
-       if not self.active:
-           return
-        user = User.objects.create_user(self.username,
-                self.email, self.password)
-        user.first_name = self.first_name
-        user.last_name = self.last_name
-        user.save()
-        profile = UserProfile(user = user)
-        profile.save()
-        self.active = False
-       self.save()
-
-        # link a person to this user. if none exists, create.
-        person = None
-        try:
-            person = Person.objects.get(email = user.email)
-        except Exception:
-            pass
-        if not person:
-            person = Person(email = user.email)
-
-        person.link_to_user(user)
-        person.save()
-
-        return user
-
 class UserPersonConfirmation(models.Model):
     user = models.ForeignKey(User)
     email = models.CharField(max_length = 200)
 class UserPersonConfirmation(models.Model):
     user = models.ForeignKey(User)
     email = models.CharField(max_length = 200)
index 4a7ccb19552c08f931a1794f41edf5bbd4017aa2..f475e74f5175a81e64ec95ae403aaeeb9964efca 100644 (file)
@@ -30,14 +30,6 @@ urlpatterns = patterns('',
     (r'^patch/(?P<patch_id>\d+)/raw/$', 'patchwork.views.patch.content'),
     (r'^patch/(?P<patch_id>\d+)/mbox/$', 'patchwork.views.patch.mbox'),
 
     (r'^patch/(?P<patch_id>\d+)/raw/$', 'patchwork.views.patch.content'),
     (r'^patch/(?P<patch_id>\d+)/mbox/$', 'patchwork.views.patch.mbox'),
 
-    # registration process
-    (r'^register/$', 'patchwork.views.user.register'),
-    (r'^register/confirm/(?P<key>[^/]+)/$',
-        'patchwork.views.user.register_confirm'),
-
-    (r'^login/$', 'patchwork.views.user.login'),
-    (r'^logout/$', 'patchwork.views.user.logout'),
-
     # logged-in user stuff
     (r'^user/$', 'patchwork.views.user.profile'),
     (r'^user/todo/$', 'patchwork.views.user.todo_lists'),
     # logged-in user stuff
     (r'^user/$', 'patchwork.views.user.profile'),
     (r'^user/todo/$', 'patchwork.views.user.todo_lists'),
index cecf51282f38aa83d6d7b61f03468dd129b103cd..dfe1c92fe3c7c6895f46cdca47e9f2c24b4fed4a 100644 (file)
@@ -19,7 +19,7 @@
 
 
 from patchwork.forms import MultiplePatchForm
 
 
 from patchwork.forms import MultiplePatchForm
-from patchwork.models import Bundle, Project, State
+from patchwork.models import Bundle, Project, State, UserProfile
 from django.conf import settings
 from django.shortcuts import render_to_response, get_object_or_404
 
 from django.conf import settings
 from django.shortcuts import render_to_response, get_object_or_404
 
@@ -191,3 +191,8 @@ def set_patches(user, project, action, data, patches, context):
         context.add_message(str)
 
     return (errors, form)
         context.add_message(str)
 
     return (errors, form)
+
+def userprofile_register_callback(user):
+    profile = UserProfile(user = user)
+    profile.save()
+
index 16fa5db360ae77fa1306419fcc131782bd466f54..85014aff67aba86fe7b420da303dfb8068f7b332 100644 (file)
@@ -18,9 +18,9 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
-from patchwork.models import Patch, Project, Person, RegistrationRequest
+from patchwork.models import Patch, Project, Person
 from patchwork.filters import Filters
 from patchwork.filters import Filters
-from patchwork.forms import RegisterForm, LoginForm, PatchForm
+from patchwork.forms import LoginForm, PatchForm
 from django.shortcuts import render_to_response, get_object_or_404
 from django.http import HttpResponse, HttpResponseRedirect
 from django.db import transaction
 from django.shortcuts import render_to_response, get_object_or_404
 from django.http import HttpResponse, HttpResponseRedirect
 from django.db import transaction
index f20f25d792e5b33321c43cf3e0a539419338ed51..c0960c12c5939625a0cfd357878afe3a792c2085 100644 (file)
@@ -18,9 +18,9 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
-from patchwork.models import Patch, Project, Person, RegistrationRequest, Bundle
+from patchwork.models import Patch, Project, Person, Bundle
 from patchwork.filters import Filters
 from patchwork.filters import Filters
-from patchwork.forms import RegisterForm, LoginForm, PatchForm, MultiplePatchForm, CreateBundleForm
+from patchwork.forms import PatchForm, MultiplePatchForm, CreateBundleForm
 from patchwork.utils import get_patch_ids, set_patches, Order
 from patchwork.requestcontext import PatchworkRequestContext
 from django.shortcuts import render_to_response, get_object_or_404
 from patchwork.utils import get_patch_ids, set_patches, Order
 from patchwork.requestcontext import PatchworkRequestContext
 from django.shortcuts import render_to_response, get_object_or_404
index 0e145494ab023a6c3888b7e3efdb21f828f17650..4a34414a01446399b5b74b70ef851f62f3cc7c8f 100644 (file)
@@ -23,10 +23,10 @@ from patchwork.requestcontext import PatchworkRequestContext
 from django.shortcuts import render_to_response, get_object_or_404
 from django.contrib import auth
 from django.http import HttpResponse, HttpResponseRedirect
 from django.shortcuts import render_to_response, get_object_or_404
 from django.contrib import auth
 from django.http import HttpResponse, HttpResponseRedirect
-from patchwork.models import Project, Patch, Bundle, Person, \
-         RegistrationRequest, UserProfile, UserPersonConfirmation, State
-from patchwork.forms import RegisterForm, LoginForm, MultiplePatchForm, \
-         UserProfileForm, UserPersonLinkForm
+from patchwork.models import Project, Patch, Bundle, Person, UserProfile, \
+        UserPersonConfirmation, State
+from patchwork.forms import MultiplePatchForm, UserProfileForm, \
+        UserPersonLinkForm
 from patchwork.utils import Order, get_patch_ids
 from patchwork.filters import DelegateFilter
 from patchwork.paginator import Paginator
 from patchwork.utils import Order, get_patch_ids
 from patchwork.filters import DelegateFilter
 from patchwork.paginator import Paginator
@@ -37,79 +37,6 @@ from django.conf import settings
 from django.core.mail import send_mail
 import django.core.urlresolvers
 
 from django.core.mail import send_mail
 import django.core.urlresolvers
 
-def register(request):
-    context = PatchworkRequestContext(request)
-    template = 'patchwork/register.html'
-
-    if request.method != 'POST':
-        form = RegisterForm()
-        context['form'] = form
-        return render_to_response(template, context)
-
-    reg_req = RegistrationRequest()
-    form = RegisterForm(instance = reg_req, data = request.POST)
-
-    if form.is_valid():
-        form.save()
-       try:
-            context['request'] = reg_req
-           send_mail('Patchwork account confirmation',
-                        render_to_string('patchwork/register.mail', context),
-                        settings.PATCHWORK_FROM_EMAIL,
-                        [form.cleaned_data['email']])
-
-        except Exception, ex:
-            context['request'] = None
-            context['error'] = 'An error occurred during registration. ' + \
-                               'Please try again later'
-
-    context['form'] = form
-
-    return render_to_response(template, context)
-
-def register_confirm(request, key):
-    context = PatchworkRequestContext(request)
-    req = get_object_or_404(RegistrationRequest, key = key)
-    req.create_user()
-    user = auth.authenticate(username = req.username, password = req.password)
-    auth.login(request, user)
-
-    return render_to_response('patchwork/register-confirm.html', context)
-
-def login(request):
-    context = PatchworkRequestContext(request)
-    template = 'patchwork/login.html'
-    error = None
-
-    if request.method == 'POST':
-        form = LoginForm(request.POST)
-        context['form'] = form
-
-        if not form.is_valid():
-            return render_to_response(template, context)
-
-        data = form.cleaned_data
-        user = auth.authenticate(username = data['username'],
-                password = data['password'])
-
-        if user is not None and user.is_active:
-            auth.login(request, user)
-            url = request.POST.get('next', None) or \
-                    django.core.urlresolvers.reverse( \
-                           'patchwork.views.user.profile')
-            return HttpResponseRedirect(url)
-
-        context['error'] = 'Invalid username or password'
-
-    else:
-        context['form'] = LoginForm()
-
-    return render_to_response(template, context)
-
-def logout(request):
-    auth.logout(request)
-    return render_to_response('patchwork/logout.html')
-
 @login_required
 def profile(request):
     context = PatchworkRequestContext(request)
 @login_required
 def profile(request):
     context = PatchworkRequestContext(request)
diff --git a/apps/registration b/apps/registration
new file mode 120000 (symlink)
index 0000000..64d0da0
--- /dev/null
@@ -0,0 +1 @@
+../lib/packages/django-registration
\ No newline at end of file
index df656dec951abc631c0ec3f1740f13d811fb4fca..8b33182de5c09ea9ead42a247d70bc179ff946f9 100644 (file)
@@ -66,7 +66,8 @@ MIDDLEWARE_CLASSES = (
 
 ROOT_URLCONF = 'apps.urls'
 
 
 ROOT_URLCONF = 'apps.urls'
 
-LOGIN_URL = '/patchwork/login'
+LOGIN_URL = '/accounts/login'
+LOGIN_REDIRECT_URL = '/user/'
 
 TEMPLATE_DIRS = (
     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
 
 TEMPLATE_DIRS = (
     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
@@ -89,7 +90,10 @@ INSTALLED_APPS = (
     'django.contrib.sites',
     'django.contrib.admin',
     'patchwork',
     'django.contrib.sites',
     'django.contrib.admin',
     'patchwork',
+    'registration',
 )
 
 DEFAULT_PATCHES_PER_PAGE = 100
 PATCHWORK_FROM_EMAIL = 'Patchwork <patchwork@patchwork.example.com>'
 )
 
 DEFAULT_PATCHES_PER_PAGE = 100
 PATCHWORK_FROM_EMAIL = 'Patchwork <patchwork@patchwork.example.com>'
+
+ACCOUNT_ACTIVATION_DAYS = 7
index ac22547d3083a1d5f8ff1a9d147845f83f65fc80..1a6f94bc08d96d8046a9bdd298787316b7d7d7a2 100644 (file)
 from django.conf.urls.defaults import *
 from patchwork.admin import admin_site
 
 from django.conf.urls.defaults import *
 from patchwork.admin import admin_site
 
+from registration.views import register
+from patchwork.forms import RegistrationForm
+from patchwork.utils import userprofile_register_callback
+
 urlpatterns = patterns('',
     # Example:
     (r'^', include('patchwork.urls')),
 
 urlpatterns = patterns('',
     # Example:
     (r'^', include('patchwork.urls')),
 
+    # override the default registration form
+    url(r'^accounts/register/$',
+        register,
+       {'form_class': RegistrationForm,
+        'profile_callback': userprofile_register_callback},
+        name='registration_register'),
+
+    (r'^accounts/', include('registration.urls')),
+
     # Uncomment this for admin:
      (r'^admin/(.*)', admin_site.root),
 
      (r'^css/(?P<path>.*)$', 'django.views.static.serve',
     # Uncomment this for admin:
      (r'^admin/(.*)', admin_site.root),
 
      (r'^css/(?P<path>.*)$', 'django.views.static.serve',
-       {'document_root': '/home/jk/devel/patchwork/pwsite/htdocs/css'}),
+       {'document_root': '/srv/patchwork/htdocs/css'}),
      (r'^js/(?P<path>.*)$', 'django.views.static.serve',
      (r'^js/(?P<path>.*)$', 'django.views.static.serve',
-       {'document_root': '/home/jk/devel/patchwork/pwsite/htdocs/js'}),
+       {'document_root': '/srv/patchwork/htdocs/js'}),
      (r'^images/(?P<path>.*)$', 'django.views.static.serve',
      (r'^images/(?P<path>.*)$', 'django.views.static.serve',
-       {'document_root': '/home/jk/devel/patchwork/pwsite/htdocs/images'}),
+       {'document_root': '/srv/patchwork/htdocs/images'}),
 )
 )
diff --git a/templates/base.html b/templates/base.html
new file mode 100644 (file)
index 0000000..df668aa
--- /dev/null
@@ -0,0 +1,79 @@
+{% load pwurl %}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+  <title>{% block title %}Patchwork{% endblock %} - Patchwork</title>
+  <link rel="stylesheet" type="text/css" href="/css/style.css"/>
+{% block headers %}{% endblock %}
+ </head>
+ <body>
+  <div id="title">
+  <h1 style="float: left;">
+     <a
+      href="{% url patchwork.views.projects %}">Patchwork</a><span
+      class="beta">&beta;</span>
+    {% block heading %}{% endblock %}</h1>
+  <div id="auth">
+{% if user.is_authenticated %}
+   Logged in as
+    <a href="{% url patchwork.views.user.profile %}"
+     ><strong>{{ user.username }}</strong></a>
+    <br/>
+     <a href="{% url patchwork.views.user.profile %}">profile</a> ::
+     <a href="{% url patchwork.views.user.todo_lists %}">todo
+      ({{ user.get_profile.n_todo_patches }})</a><br/>
+     <a href="{% url auth_logout %}">logout</a><!-- ::
+     <a href="/help/">help</a> -->
+{% else %}
+     <a href="{% url auth_login %}">login</a>
+     <br/>
+     <a href="{% url registration_register %}">register</a>
+     <!--
+     <br/>
+     <a href="/help/">help</a>
+     -->
+{% endif %}
+   </div>
+   <div style="clear: both;"></div>
+  </div>
+  <div id="nav">
+  {% if project %}
+   <strong>Project</strong>: {{ project.linkname }}
+    :
+    <a href="{% url patchwork.views.patch.list project_id=project.linkname %}"
+     >patches</a>
+    :
+    <a href="{% url patchwork.views.project project_id=project.linkname %}"
+     >project info</a>
+   {% if other_projects %}
+    :
+    <a href="{% url patchwork.views.projects %}"
+    >other projects</a>
+    {% endif %}
+   {% else %}
+    <a href="{% url patchwork.views.projects %}"
+    >project list</a>
+   {% endif %}
+  </div>
+{% if messages %}
+  <div id="messages">
+  {% for message in messages %}
+   <div class="message">{{ message }}</div>
+  {% endfor %}
+  </div>
+{% endif %}
+  <div id="content">
+{% block body %}
+{% endblock %}
+  </div>
+  <div id="footer">
+   <a href="http://ozlabs.org/~jk/projects/patchwork">patchwork</a>
+   patch tracking system
+  </div>
+ </body>
+</html>
+
+
+
diff --git a/templates/patchwork/base.html b/templates/patchwork/base.html
deleted file mode 100644 (file)
index 233ce97..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-{% load pwurl %}
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
-  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-  <title>{% block title %}Patchwork{% endblock %} - Patchwork</title>
-  <link rel="stylesheet" type="text/css" href="/css/style.css"/>
-{% block headers %}{% endblock %}
- </head>
- <body>
-  <div id="title">
-  <h1 style="float: left;">
-     <a
-      href="{% url patchwork.views.projects %}">Patchwork</a><span
-      class="beta">&beta;</span>
-    {% block heading %}{% endblock %}</h1>
-  <div id="auth">
-{% if user.is_authenticated %}
-   Logged in as
-    <a href="{% url patchwork.views.user.profile %}"
-     ><strong>{{ user.username }}</strong></a>
-    <br/>
-     <a href="{% url patchwork.views.user.profile %}">profile</a> ::
-     <a href="{% url patchwork.views.user.todo_lists %}">todo
-      ({{ user.get_profile.n_todo_patches }})</a><br/>
-     <a href="{% url patchwork.views.user.logout %}">logout</a><!-- ::
-     <a href="/help/">help</a> -->
-{% else %}
-     <a href="{% url patchwork.views.user.login %}">login</a>
-     <br/>
-     <a href="{% url patchwork.views.user.register %}">register</a>
-     <!--
-     <br/>
-     <a href="/help/">help</a>
-     -->
-{% endif %}
-   </div>
-   <div style="clear: both;"></div>
-  </div>
-  <div id="nav">
-  {% if project %}
-   <strong>Project</strong>: {{ project.linkname }}
-    :
-    <a href="{% url patchwork.views.patch.list project_id=project.linkname %}"
-     >patches</a>
-    :
-    <a href="{% url patchwork.views.project project_id=project.linkname %}"
-     >project info</a>
-   {% if other_projects %}
-    :
-    <a href="{% url patchwork.views.projects %}"
-    >other projects</a>
-    {% endif %}
-   {% else %}
-    <a href="{% url patchwork.views.projects %}"
-    >project list</a>
-   {% endif %}
-  </div>
-{% if messages %}
-  <div id="messages">
-  {% for message in messages %}
-   <div class="message">{{ message }}</div>
-  {% endfor %}
-  </div>
-{% endif %}
-  <div id="content">
-{% block body %}
-{% endblock %}
-  </div>
-  <div id="footer">
-   <a href="http://ozlabs.org/~jk/projects/patchwork">patchwork</a>
-   patch tracking system
-  </div>
- </body>
-</html>
-
-
-
index 0ee57da90eaadfcb53a28f96fbafb0d5c25a5dea..3590c4624bc4e73492cba2efc9aa00b67b189b5c 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% load person %}
 
 
 {% load person %}
 
index 8fa694a640a56967e979f39eac8886ac7d160bc7..68bf5705bed7af347dcbbaabf024906984bf3379 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% load person %}
 
 
 {% load person %}
 
index 755c0471991008f27f94472ba65ff350cd4a0296..805406333a5f97fde73283d3b2210bda3e46b05c 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% load person %}
 
 
 {% load person %}
 
diff --git a/templates/patchwork/login.html b/templates/patchwork/login.html
deleted file mode 100644 (file)
index 4706dda..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-{% extends "patchwork/base.html" %}
-
-{% block title %}Patchwork Login{% endblock %}
-{% block heading %}Patchwork Login{% endblock %}
-
-
-{% block body %}
-<form method="post">
-<table class="form loginform">
- <tr>
-  <th colspan="2" class="headerrow">login</th>
- </tr>
- {% if error %}
-  <tr>
-   <td colspan="2">{{ error }}</td>
-  </tr>
- {% endif %}
- {{ form }}
- <tr>
-  <td colspan="2" class="submitrow">
-   <input type="submit" value="Login"/>
-  </td>
- </tr>
-</table>
-</form>
-{% endblock %}
diff --git a/templates/patchwork/logout.html b/templates/patchwork/logout.html
deleted file mode 100644 (file)
index 737f1ce..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-{% extends "patchwork/base.html" %}
-
-{% block title %}Patchwork{% endblock %}
-{% block heading %}Patchwork{% endblock %}
-
-{% block body %}
-<p>Logged out</p>
-{% endblock %}
index b793f39b09135fece4bc3dcef37b2fab8ace847d..2382978162c3e10ecdc6c8b5d8e782d7697dfd08 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% load syntax %}
 {% load person %}
 
 {% load syntax %}
 {% load person %}
index 35f3d4ff3e3c04f90fe9c3e9d5038a3190ab4c04..81005a36616f165cb476203a74530325899b3ef8 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% block title %}User Profile: {{ user.username }}{% endblock %}
 {% block heading %}User Profile: {{ user.username }}{% endblock %}
 
 {% block title %}User Profile: {{ user.username }}{% endblock %}
 {% block heading %}User Profile: {{ user.username }}{% endblock %}
index 4ea10094e5fcbc1b102ee07e277bc2bd290b44b0..f29540cedfc3eb2437ca29f411d7d7ccd7b6a62a 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% block title %}{{ project.name }}{% endblock %}
 {% block heading %}{{ project.name }}{% endblock %}
 
 {% block title %}{{ project.name }}{% endblock %}
 {% block heading %}{{ project.name }}{% endblock %}
index 349f31417f632fccced3cdc39b1ad0bada42de96..aa6df82865bfb9d801e575ec6a61eaba4557c581 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% block title %}Project List{% endblock %}
 {% block heading %}Project List{% endblock %}
 
 {% block title %}Project List{% endblock %}
 {% block heading %}Project List{% endblock %}
diff --git a/templates/patchwork/register-confirm.html b/templates/patchwork/register-confirm.html
deleted file mode 100644 (file)
index 2af5744..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-{% extends "patchwork/base.html" %}
-
-{% block title %}Registration{% endblock %}
-{% block heading %}Registration{% endblock %}
-
-{% block body %}
-<p>Registraton confirmed!</p>
-
-<p>Your patchwork registration is complete. Head over to your <a
- href="{% url patchwork.views.user.profile %}">profile</a> to start using
-patchwork's extra features.</p>
-
-{% endblock %}
diff --git a/templates/patchwork/register.html b/templates/patchwork/register.html
deleted file mode 100644 (file)
index 4790fac..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-{% extends "patchwork/base.html" %}
-
-{% block title %}Patchwork Registration{% endblock %}
-{% block heading %}Patchwork Registration{% endblock %}
-
-
-{% block body %}
-
-{% if request and not error %}
- <p>Registration successful!</p>
- <p>A confirmation email has been sent to {{ request.email }}. You'll
- need to visit the link provided in that email to confirm your
- registration.</p>
- <pre>{{email}}</pre>
-</p>
-{% else %}
-<p>By creating a patchwork account, you can:<p>
-<ul>
- <li>create "bundles" of patches</li>
- <li>update the state of your own patches</li>
-</ul>
-<form method="post">
-<table class="form registerform">
- <tr>
-  <th colspan="2" class="headerrow">register</th>
- </tr>
- {% if error %}
-  <tr>
-   <td colspan="2">{{ error }}</td>
-  </tr>
- {% endif %}
-
-  <tr>
-   <td>{{ form.first_name.label_tag }}</td>
-   <td>
-{% if form.first_name.errors %}
-    {{ form.first_name.errors }}
-{% endif %}
-    {{ form.first_name }}
-{% if form.first_name.help_text %}
-    <div class="help_text"/>{{ form.first_name.help_text }}</div>
-{% endif %}
-   </td>
-  </tr>
-   
-  <tr>
-   <td>{{ form.last_name.label_tag }}</td>
-   <td>
-{% if form.last_name.errors %}
-    {{ form.last_name.errors }}
-{% endif %}
-    {{ form.last_name }}
-{% if form.last_name.help_text %}
-    <div class="help_text"/>{{ form.last_name.help_text }}</div>
-{% endif %}
-   </td>
-  </tr>
-
-  <tr>
-   <td></td>
-   <td class="form-help">
-    Your name is used to identify you on the site
-   </td>
-  </tr>
-   
-  <tr>
-   <td>{{ form.email.label_tag }}</td>
-   <td>
-{% if form.email.errors %}
-    {{ form.email.errors }}
-{% endif %}
-    {{ form.email }}
-{% if form.email.help_text %}
-    <div class="help_text"/>{{ form.email.help_text }}</div>
-{% endif %}
-   </td>
-  </tr>
-   
-  <tr>
-   <td></td>
-   <td class="form-help">
-    Patchwork will send a confirmation email to this address
-   </td>
-  </tr>
-
-  <tr>
-   <td>{{ form.username.label_tag }}</td>
-   <td>
-{% if form.username.errors %}
-    {{ form.username.errors }}
-{% endif %}
-    {{ form.username }}
-{% if form.username.help_text %}
-    <div class="help_text"/>{{ form.username.help_text }}</div>
-{% endif %}
-   </td>
-  </tr>
-   
-  <tr>
-   <td>{{ form.password.label_tag }}</td>
-   <td>
-{% if form.password.errors %}
-    {{ form.password.errors }}
-{% endif %}
-    {{ form.password }}
-{% if form.password.help_text %}
-    <div class="help_text"/>{{ form.password.help_text }}</div>
-{% endif %}
-   </td>
-  </tr>
-   
- <tr>
-  <td colspan="2" class="submitrow">
-   <input type="submit" value="Register"/>
-  </td>
- </tr>
-</table>
-</form>
-{% endif %}
-
-{% endblock %}
index 86dcd145e2bacb0d66308e098e8767487579265b..9bb5232f26823c025e9dcdca252d28a459ed09a7 100644 (file)
@@ -3,7 +3,7 @@ Hi,
 This email is to confirm your account on the patchwork patch-tracking
 system. You can activate your account by visiting the url:
 
 This email is to confirm your account on the patchwork patch-tracking
 system. You can activate your account by visiting the url:
 
- http://{{site.domain}}{% url patchwork.views.user.register_confirm key=request.key %}
+ http://{{site.domain}}{% url registration_activateactivation_key=request.key %}
 
 If you didn't request a user account on patchwork, then you can ignore
 this mail.
 
 If you didn't request a user account on patchwork, then you can ignore
 this mail.
index 8a5ab7a84d5870d5d78d246ee046e32cf111ab59..b3019017e3cf8389ac1d5ba181d395091638a236 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% load person %}
 
 
 {% load person %}
 
index 8eb10cc7867477545ec07d7fb64178aa5f8d8d64..47dbf03f026d8a8332b32d9f1842dd5fa7e8853a 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% block title %}{{ user }}'s todo lists{% endblock %}
 {% block heading %}{{ user }}'s todo lists{% endblock %}
 
 {% block title %}{{ user }}'s todo lists{% endblock %}
 {% block heading %}{{ user }}'s todo lists{% endblock %}
index 61979cf4f948096537741238dd6118d973947cb1..3e7b6edebc09e24c55761a9d710f453f514d87c6 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% block title %}{{ user.username }}{% endblock %}
 {% block heading %}link accounts for {{ user.username }}{% endblock %}
 
 {% block title %}{{ user.username }}{% endblock %}
 {% block heading %}link accounts for {{ user.username }}{% endblock %}
index dfad341e8ba3b4391d383bfe3b34408ab811784c..2ed193efe26ece9dc6378aede1f4516a461982a9 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "patchwork/base.html" %}
+{% extends "base.html" %}
 
 {% block title %}{{ user.username }}{% endblock %}
 {% block heading %}link accounts for {{ user.username }}{% endblock %}
 
 {% block title %}{{ user.username }}{% endblock %}
 {% block heading %}link accounts for {{ user.username }}{% endblock %}
diff --git a/templates/registration/activate.html b/templates/registration/activate.html
new file mode 100644 (file)
index 0000000..f0cc39f
--- /dev/null
@@ -0,0 +1,13 @@
+{% extends "base.html" %}
+
+{% block title %}Registration{% endblock %}
+{% block heading %}Registration{% endblock %}
+
+{% block body %}
+<p>Registraton confirmed!</p>
+
+<p>Your patchwork registration is complete. Head over to your <a
+ href="{% url patchwork.views.user.profile %}">profile</a> to start using
+patchwork's extra features.</p>
+
+{% endblock %}
diff --git a/templates/registration/activation_email.txt b/templates/registration/activation_email.txt
new file mode 100644 (file)
index 0000000..6b1477d
--- /dev/null
@@ -0,0 +1,11 @@
+Hi,
+
+This email is to confirm your account on the patchwork patch-tracking
+system. You can activate your account by visiting the url:
+
+ http://{{site.domain}}{% url registration_activate activation_key=activation_key %}
+
+If you didn't request a user account on patchwork, then you can ignore
+this mail.
+
+Happy patchworking.
diff --git a/templates/registration/activation_email_subject.txt b/templates/registration/activation_email_subject.txt
new file mode 100644 (file)
index 0000000..c409f38
--- /dev/null
@@ -0,0 +1 @@
+Patchwork account confirmation
diff --git a/templates/registration/login.html b/templates/registration/login.html
new file mode 100644 (file)
index 0000000..d01d055
--- /dev/null
@@ -0,0 +1,26 @@
+{% extends "base.html" %}
+
+{% block title %}Patchwork Login{% endblock %}
+{% block heading %}Patchwork Login{% endblock %}
+
+
+{% block body %}
+<form method="post">
+<table class="form loginform">
+ <tr>
+  <th colspan="2" class="headerrow">login</th>
+ </tr>
+ {% if error %}
+  <tr>
+   <td colspan="2">{{ error }}</td>
+  </tr>
+ {% endif %}
+ {{ form }}
+ <tr>
+  <td colspan="2" class="submitrow">
+   <input type="submit" value="Login"/>
+  </td>
+ </tr>
+</table>
+</form>
+{% endblock %}
diff --git a/templates/registration/logout.html b/templates/registration/logout.html
new file mode 100644 (file)
index 0000000..3128d97
--- /dev/null
@@ -0,0 +1,8 @@
+{% extends "base.html" %}
+
+{% block title %}Patchwork{% endblock %}
+{% block heading %}Patchwork{% endblock %}
+
+{% block body %}
+<p>Logged out</p>
+{% endblock %}
diff --git a/templates/registration/registration_complete.html b/templates/registration/registration_complete.html
new file mode 100644 (file)
index 0000000..47ee3f2
--- /dev/null
@@ -0,0 +1,13 @@
+{% extends "base.html" %}
+
+{% block title %}Patchwork Registration{% endblock %}
+{% block heading %}Patchwork Registration{% endblock %}
+
+{% block body %}
+
+ <p>Registration successful!</p>
+ <p>A confirmation email has been sent to your email address. You'll
+ need to visit the link provided in that email to actiavate your
+ patchwork account.</p>
+
+{% endblock %}
diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html
new file mode 100644 (file)
index 0000000..c8ce116
--- /dev/null
@@ -0,0 +1,121 @@
+{% extends "base.html" %}
+
+{% block title %}Patchwork Registration{% endblock %}
+{% block heading %}Patchwork Registration{% endblock %}
+
+
+{% block body %}
+
+{% if request and not error %}
+ <p>Registration successful!</p>
+ <p>A confirmation email has been sent to {{ request.email }}. You'll
+ need to visit the link provided in that email to confirm your
+ registration.</p>
+ <pre>{{email}}</pre>
+</p>
+{% else %}
+<p>By creating a patchwork account, you can:<p>
+<ul>
+ <li>create "bundles" of patches</li>
+ <li>update the state of your own patches</li>
+</ul>
+<form method="post">
+<table class="form registerform">
+ <tr>
+  <th colspan="2" class="headerrow">register</th>
+ </tr>
+ {% if error %}
+  <tr>
+   <td colspan="2">{{ error }}</td>
+  </tr>
+ {% endif %}
+
+  <tr>
+   <td>{{ form.first_name.label_tag }}</td>
+   <td>
+{% if form.first_name.errors %}
+    {{ form.first_name.errors }}
+{% endif %}
+    {{ form.first_name }}
+{% if form.first_name.help_text %}
+    <div class="help_text"/>{{ form.first_name.help_text }}</div>
+{% endif %}
+   </td>
+  </tr>
+   
+  <tr>
+   <td>{{ form.last_name.label_tag }}</td>
+   <td>
+{% if form.last_name.errors %}
+    {{ form.last_name.errors }}
+{% endif %}
+    {{ form.last_name }}
+{% if form.last_name.help_text %}
+    <div class="help_text"/>{{ form.last_name.help_text }}</div>
+{% endif %}
+   </td>
+  </tr>
+
+  <tr>
+   <td></td>
+   <td class="form-help">
+    Your name is used to identify you on the site
+   </td>
+  </tr>
+   
+  <tr>
+   <td>{{ form.email.label_tag }}</td>
+   <td>
+{% if form.email.errors %}
+    {{ form.email.errors }}
+{% endif %}
+    {{ form.email }}
+{% if form.email.help_text %}
+    <div class="help_text"/>{{ form.email.help_text }}</div>
+{% endif %}
+   </td>
+  </tr>
+   
+  <tr>
+   <td></td>
+   <td class="form-help">
+    Patchwork will send a confirmation email to this address
+   </td>
+  </tr>
+
+  <tr>
+   <td>{{ form.username.label_tag }}</td>
+   <td>
+{% if form.username.errors %}
+    {{ form.username.errors }}
+{% endif %}
+    {{ form.username }}
+{% if form.username.help_text %}
+    <div class="help_text"/>{{ form.username.help_text }}</div>
+{% endif %}
+   </td>
+  </tr>
+   
+  <tr>
+   <td>{{ form.password.label_tag }}</td>
+   <td>
+{% if form.password.errors %}
+    {{ form.password.errors }}
+{% endif %}
+    {{ form.password }}
+{% if form.password.help_text %}
+    <div class="help_text"/>{{ form.password.help_text }}</div>
+{% endif %}
+   </td>
+  </tr>
+
+   <tr>
+  <td colspan="2" class="submitrow">
+   <input type="submit" value="Register"/>
+  </td>
+ </tr>
+</table>
+</form>
+{% endif %}
+
+{% endblock %}