From: Jeremy Kerr Date: Fri, 22 Aug 2008 02:41:25 +0000 (+0800) Subject: Use django-registration infrastructure X-Git-Url: https://git.ozlabs.org/?p=patchwork;a=commitdiff_plain;h=f1e089f7736ac8f7b9af784461350c4c169211ad Use django-registration infrastructure Signed-off-by: Jeremy Kerr --- diff --git a/apps/patchwork/forms.py b/apps/patchwork/forms.py index a758d46..7adc8c0 100644 --- a/apps/patchwork/forms.py +++ b/apps/patchwork/forms.py @@ -21,48 +21,33 @@ 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) diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index e3fc9c7..a40931a 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -129,43 +129,6 @@ def _confirm_key(): 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) diff --git a/apps/patchwork/urls.py b/apps/patchwork/urls.py index 4a7ccb1..f475e74 100644 --- a/apps/patchwork/urls.py +++ b/apps/patchwork/urls.py @@ -30,14 +30,6 @@ urlpatterns = patterns('', (r'^patch/(?P\d+)/raw/$', 'patchwork.views.patch.content'), (r'^patch/(?P\d+)/mbox/$', 'patchwork.views.patch.mbox'), - # registration process - (r'^register/$', 'patchwork.views.user.register'), - (r'^register/confirm/(?P[^/]+)/$', - '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'), diff --git a/apps/patchwork/utils.py b/apps/patchwork/utils.py index cecf512..dfe1c92 100644 --- a/apps/patchwork/utils.py +++ b/apps/patchwork/utils.py @@ -19,7 +19,7 @@ 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 @@ -191,3 +191,8 @@ def set_patches(user, project, action, data, patches, context): context.add_message(str) return (errors, form) + +def userprofile_register_callback(user): + profile = UserProfile(user = user) + profile.save() + diff --git a/apps/patchwork/views/base.py b/apps/patchwork/views/base.py index 16fa5db..85014af 100644 --- a/apps/patchwork/views/base.py +++ b/apps/patchwork/views/base.py @@ -18,9 +18,9 @@ # 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.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 diff --git a/apps/patchwork/views/patch.py b/apps/patchwork/views/patch.py index f20f25d..c0960c1 100644 --- a/apps/patchwork/views/patch.py +++ b/apps/patchwork/views/patch.py @@ -18,9 +18,9 @@ # 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.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 diff --git a/apps/patchwork/views/user.py b/apps/patchwork/views/user.py index 0e14549..4a34414 100644 --- a/apps/patchwork/views/user.py +++ b/apps/patchwork/views/user.py @@ -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 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 @@ -37,79 +37,6 @@ from django.conf import settings 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) diff --git a/apps/registration b/apps/registration new file mode 120000 index 0000000..64d0da0 --- /dev/null +++ b/apps/registration @@ -0,0 +1 @@ +../lib/packages/django-registration \ No newline at end of file diff --git a/apps/settings.py b/apps/settings.py index df656de..8b33182 100644 --- a/apps/settings.py +++ b/apps/settings.py @@ -66,7 +66,8 @@ MIDDLEWARE_CLASSES = ( 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". @@ -89,7 +90,10 @@ INSTALLED_APPS = ( 'django.contrib.sites', 'django.contrib.admin', 'patchwork', + 'registration', ) DEFAULT_PATCHES_PER_PAGE = 100 PATCHWORK_FROM_EMAIL = 'Patchwork ' + +ACCOUNT_ACTIVATION_DAYS = 7 diff --git a/apps/urls.py b/apps/urls.py index ac22547..1a6f94b 100644 --- a/apps/urls.py +++ b/apps/urls.py @@ -20,17 +20,30 @@ 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')), + # 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.*)$', 'django.views.static.serve', - {'document_root': '/home/jk/devel/patchwork/pwsite/htdocs/css'}), + {'document_root': '/srv/patchwork/htdocs/css'}), (r'^js/(?P.*)$', 'django.views.static.serve', - {'document_root': '/home/jk/devel/patchwork/pwsite/htdocs/js'}), + {'document_root': '/srv/patchwork/htdocs/js'}), (r'^images/(?P.*)$', '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 index 0000000..df668aa --- /dev/null +++ b/templates/base.html @@ -0,0 +1,79 @@ +{% load pwurl %} + + + + + {% block title %}Patchwork{% endblock %} - Patchwork + +{% block headers %}{% endblock %} + + +
+

+ Patchworkβ + {% block heading %}{% endblock %}

+
+{% if user.is_authenticated %} + Logged in as + {{ user.username }} +
+ profile :: + todo + ({{ user.get_profile.n_todo_patches }})
+ logout +{% else %} + login +
+ register + +{% endif %} +
+
+
+ +{% if messages %} +
+ {% for message in messages %} +
{{ message }}
+ {% endfor %} +
+{% endif %} +
+{% block body %} +{% endblock %} +
+ + + + + + diff --git a/templates/patchwork/base.html b/templates/patchwork/base.html deleted file mode 100644 index 233ce97..0000000 --- a/templates/patchwork/base.html +++ /dev/null @@ -1,79 +0,0 @@ -{% load pwurl %} - - - - - {% block title %}Patchwork{% endblock %} - Patchwork - -{% block headers %}{% endblock %} - - -
-

- Patchworkβ - {% block heading %}{% endblock %}

-
-{% if user.is_authenticated %} - Logged in as - {{ user.username }} -
- profile :: - todo - ({{ user.get_profile.n_todo_patches }})
- logout -{% else %} - login -
- register - -{% endif %} -
-
-
- -{% if messages %} -
- {% for message in messages %} -
{{ message }}
- {% endfor %} -
-{% endif %} -
-{% block body %} -{% endblock %} -
- - - - - - diff --git a/templates/patchwork/bundle-public.html b/templates/patchwork/bundle-public.html index 0ee57da..3590c46 100644 --- a/templates/patchwork/bundle-public.html +++ b/templates/patchwork/bundle-public.html @@ -1,4 +1,4 @@ -{% extends "patchwork/base.html" %} +{% extends "base.html" %} {% load person %} diff --git a/templates/patchwork/bundle.html b/templates/patchwork/bundle.html index 8fa694a..68bf570 100644 --- a/templates/patchwork/bundle.html +++ b/templates/patchwork/bundle.html @@ -1,4 +1,4 @@ -{% extends "patchwork/base.html" %} +{% extends "base.html" %} {% load person %} diff --git a/templates/patchwork/list.html b/templates/patchwork/list.html index 755c047..8054063 100644 --- a/templates/patchwork/list.html +++ b/templates/patchwork/list.html @@ -1,4 +1,4 @@ -{% extends "patchwork/base.html" %} +{% extends "base.html" %} {% load person %} diff --git a/templates/patchwork/login.html b/templates/patchwork/login.html deleted file mode 100644 index 4706dda..0000000 --- a/templates/patchwork/login.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends "patchwork/base.html" %} - -{% block title %}Patchwork Login{% endblock %} -{% block heading %}Patchwork Login{% endblock %} - - -{% block body %} -
- - - - - {% if error %} - - - - {% endif %} - {{ form }} - - - -
login
{{ error }}
- -
-
-{% endblock %} diff --git a/templates/patchwork/logout.html b/templates/patchwork/logout.html deleted file mode 100644 index 737f1ce..0000000 --- a/templates/patchwork/logout.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "patchwork/base.html" %} - -{% block title %}Patchwork{% endblock %} -{% block heading %}Patchwork{% endblock %} - -{% block body %} -

Logged out

-{% endblock %} diff --git a/templates/patchwork/patch.html b/templates/patchwork/patch.html index b793f39..2382978 100644 --- a/templates/patchwork/patch.html +++ b/templates/patchwork/patch.html @@ -1,4 +1,4 @@ -{% extends "patchwork/base.html" %} +{% extends "base.html" %} {% load syntax %} {% load person %} diff --git a/templates/patchwork/profile.html b/templates/patchwork/profile.html index 35f3d4f..81005a3 100644 --- a/templates/patchwork/profile.html +++ b/templates/patchwork/profile.html @@ -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 %} diff --git a/templates/patchwork/project.html b/templates/patchwork/project.html index 4ea1009..f29540c 100644 --- a/templates/patchwork/project.html +++ b/templates/patchwork/project.html @@ -1,4 +1,4 @@ -{% extends "patchwork/base.html" %} +{% extends "base.html" %} {% block title %}{{ project.name }}{% endblock %} {% block heading %}{{ project.name }}{% endblock %} diff --git a/templates/patchwork/projects.html b/templates/patchwork/projects.html index 349f314..aa6df82 100644 --- a/templates/patchwork/projects.html +++ b/templates/patchwork/projects.html @@ -1,4 +1,4 @@ -{% extends "patchwork/base.html" %} +{% extends "base.html" %} {% 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 index 2af5744..0000000 --- a/templates/patchwork/register-confirm.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "patchwork/base.html" %} - -{% block title %}Registration{% endblock %} -{% block heading %}Registration{% endblock %} - -{% block body %} -

Registraton confirmed!

- -

Your patchwork registration is complete. Head over to your profile to start using -patchwork's extra features.

- -{% endblock %} diff --git a/templates/patchwork/register.html b/templates/patchwork/register.html deleted file mode 100644 index 4790fac..0000000 --- a/templates/patchwork/register.html +++ /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 %} -

Registration successful!

-

A confirmation email has been sent to {{ request.email }}. You'll - need to visit the link provided in that email to confirm your - registration.

-
{{email}}
-

-{% else %} -

By creating a patchwork account, you can:

-

    -
  • create "bundles" of patches
  • -
  • update the state of your own patches
  • -
-
- - - - - {% if error %} - - - - {% endif %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
register
{{ error }}
{{ form.first_name.label_tag }} -{% if form.first_name.errors %} - {{ form.first_name.errors }} -{% endif %} - {{ form.first_name }} -{% if form.first_name.help_text %} -
{{ form.first_name.help_text }}
-{% endif %} -
{{ form.last_name.label_tag }} -{% if form.last_name.errors %} - {{ form.last_name.errors }} -{% endif %} - {{ form.last_name }} -{% if form.last_name.help_text %} -
{{ form.last_name.help_text }}
-{% endif %} -
- Your name is used to identify you on the site -
{{ form.email.label_tag }} -{% if form.email.errors %} - {{ form.email.errors }} -{% endif %} - {{ form.email }} -{% if form.email.help_text %} -
{{ form.email.help_text }}
-{% endif %} -
- Patchwork will send a confirmation email to this address -
{{ form.username.label_tag }} -{% if form.username.errors %} - {{ form.username.errors }} -{% endif %} - {{ form.username }} -{% if form.username.help_text %} -
{{ form.username.help_text }}
-{% endif %} -
{{ form.password.label_tag }} -{% if form.password.errors %} - {{ form.password.errors }} -{% endif %} - {{ form.password }} -{% if form.password.help_text %} -
{{ form.password.help_text }}
-{% endif %} -
- -
-
-{% endif %} - -{% endblock %} diff --git a/templates/patchwork/register.mail b/templates/patchwork/register.mail index 86dcd14..9bb5232 100644 --- a/templates/patchwork/register.mail +++ b/templates/patchwork/register.mail @@ -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: - 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. diff --git a/templates/patchwork/todo-list.html b/templates/patchwork/todo-list.html index 8a5ab7a..b301901 100644 --- a/templates/patchwork/todo-list.html +++ b/templates/patchwork/todo-list.html @@ -1,4 +1,4 @@ -{% extends "patchwork/base.html" %} +{% extends "base.html" %} {% load person %} diff --git a/templates/patchwork/todo-lists.html b/templates/patchwork/todo-lists.html index 8eb10cc..47dbf03 100644 --- a/templates/patchwork/todo-lists.html +++ b/templates/patchwork/todo-lists.html @@ -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 %} diff --git a/templates/patchwork/user-link-confirm.html b/templates/patchwork/user-link-confirm.html index 61979cf..3e7b6ed 100644 --- a/templates/patchwork/user-link-confirm.html +++ b/templates/patchwork/user-link-confirm.html @@ -1,4 +1,4 @@ -{% extends "patchwork/base.html" %} +{% extends "base.html" %} {% block title %}{{ user.username }}{% endblock %} {% block heading %}link accounts for {{ user.username }}{% endblock %} diff --git a/templates/patchwork/user-link.html b/templates/patchwork/user-link.html index dfad341..2ed193e 100644 --- a/templates/patchwork/user-link.html +++ b/templates/patchwork/user-link.html @@ -1,4 +1,4 @@ -{% extends "patchwork/base.html" %} +{% extends "base.html" %} {% 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 index 0000000..f0cc39f --- /dev/null +++ b/templates/registration/activate.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block title %}Registration{% endblock %} +{% block heading %}Registration{% endblock %} + +{% block body %} +

Registraton confirmed!

+ +

Your patchwork registration is complete. Head over to your profile to start using +patchwork's extra features.

+ +{% endblock %} diff --git a/templates/registration/activation_email.txt b/templates/registration/activation_email.txt new file mode 100644 index 0000000..6b1477d --- /dev/null +++ b/templates/registration/activation_email.txt @@ -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 index 0000000..c409f38 --- /dev/null +++ b/templates/registration/activation_email_subject.txt @@ -0,0 +1 @@ +Patchwork account confirmation diff --git a/templates/registration/login.html b/templates/registration/login.html new file mode 100644 index 0000000..d01d055 --- /dev/null +++ b/templates/registration/login.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} + +{% block title %}Patchwork Login{% endblock %} +{% block heading %}Patchwork Login{% endblock %} + + +{% block body %} +
+ + + + + {% if error %} + + + + {% endif %} + {{ form }} + + + +
login
{{ error }}
+ +
+
+{% endblock %} diff --git a/templates/registration/logout.html b/templates/registration/logout.html new file mode 100644 index 0000000..3128d97 --- /dev/null +++ b/templates/registration/logout.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{% block title %}Patchwork{% endblock %} +{% block heading %}Patchwork{% endblock %} + +{% block body %} +

Logged out

+{% endblock %} diff --git a/templates/registration/registration_complete.html b/templates/registration/registration_complete.html new file mode 100644 index 0000000..47ee3f2 --- /dev/null +++ b/templates/registration/registration_complete.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block title %}Patchwork Registration{% endblock %} +{% block heading %}Patchwork Registration{% endblock %} + +{% block body %} + +

Registration successful!

+

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.

+ +{% endblock %} diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html new file mode 100644 index 0000000..c8ce116 --- /dev/null +++ b/templates/registration/registration_form.html @@ -0,0 +1,121 @@ +{% extends "base.html" %} + +{% block title %}Patchwork Registration{% endblock %} +{% block heading %}Patchwork Registration{% endblock %} + + +{% block body %} + +{% if request and not error %} +

Registration successful!

+

A confirmation email has been sent to {{ request.email }}. You'll + need to visit the link provided in that email to confirm your + registration.

+
{{email}}
+

+{% else %} +

By creating a patchwork account, you can:

+

    +
  • create "bundles" of patches
  • +
  • update the state of your own patches
  • +
+
+ + + + + {% if error %} + + + + {% endif %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
register
{{ error }}
{{ form.first_name.label_tag }} +{% if form.first_name.errors %} + {{ form.first_name.errors }} +{% endif %} + {{ form.first_name }} +{% if form.first_name.help_text %} +
{{ form.first_name.help_text }}
+{% endif %} +
{{ form.last_name.label_tag }} +{% if form.last_name.errors %} + {{ form.last_name.errors }} +{% endif %} + {{ form.last_name }} +{% if form.last_name.help_text %} +
{{ form.last_name.help_text }}
+{% endif %} +
+ Your name is used to identify you on the site +
{{ form.email.label_tag }} +{% if form.email.errors %} + {{ form.email.errors }} +{% endif %} + {{ form.email }} +{% if form.email.help_text %} +
{{ form.email.help_text }}
+{% endif %} +
+ Patchwork will send a confirmation email to this address +
{{ form.username.label_tag }} +{% if form.username.errors %} + {{ form.username.errors }} +{% endif %} + {{ form.username }} +{% if form.username.help_text %} +
{{ form.username.help_text }}
+{% endif %} +
{{ form.password.label_tag }} +{% if form.password.errors %} + {{ form.password.errors }} +{% endif %} + {{ form.password }} +{% if form.password.help_text %} +
{{ form.password.help_text }}
+{% endif %} +
+ +
+
+{% endif %} + +{% endblock %}