From 84f5d4f5210ee75cb2eef8e7d21fbb13690f9f50 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 26 Dec 2010 19:04:28 +0100 Subject: Integration of registration module --- docs/src/INSTALL.t2t | 2 +- ishtar/furnitures/views.py | 38 +++++++++++++++++++++- ishtar/settings.py.example | 3 +- ishtar/templates/base.html | 34 +++++++++++++++++++ ishtar/templates/index.html | 2 ++ ishtar/templates/registration/activate.html | 18 ++++++++++ ishtar/templates/registration/activation_email.txt | 6 ++++ .../registration/activation_email_subject.txt | 1 + ishtar/templates/registration/login.html | 18 ++++++++++ ishtar/templates/registration/logout.html | 6 ++++ .../registration/password_change_done.html | 6 ++++ .../registration/password_change_form.html | 10 ++++++ .../registration/password_reset_complete.html | 10 ++++++ .../registration/password_reset_confirm.html | 20 ++++++++++++ .../registration/password_reset_done.html | 6 ++++ .../registration/password_reset_email.html | 5 +++ .../registration/password_reset_form.html | 10 ++++++ .../registration/registration_complete.html | 6 ++++ .../templates/registration/registration_form.html | 10 ++++++ ishtar/urls.py | 9 ++--- 20 files changed, 210 insertions(+), 10 deletions(-) create mode 100644 ishtar/templates/base.html create mode 100644 ishtar/templates/index.html create mode 100644 ishtar/templates/registration/activate.html create mode 100644 ishtar/templates/registration/activation_email.txt create mode 100644 ishtar/templates/registration/activation_email_subject.txt create mode 100644 ishtar/templates/registration/login.html create mode 100644 ishtar/templates/registration/logout.html create mode 100644 ishtar/templates/registration/password_change_done.html create mode 100644 ishtar/templates/registration/password_change_form.html create mode 100644 ishtar/templates/registration/password_reset_complete.html create mode 100644 ishtar/templates/registration/password_reset_confirm.html create mode 100644 ishtar/templates/registration/password_reset_done.html create mode 100644 ishtar/templates/registration/password_reset_email.html create mode 100644 ishtar/templates/registration/password_reset_form.html create mode 100644 ishtar/templates/registration/registration_complete.html create mode 100644 ishtar/templates/registration/registration_form.html diff --git a/docs/src/INSTALL.t2t b/docs/src/INSTALL.t2t index 9cc6aa6d1..6966e7147 100644 --- a/docs/src/INSTALL.t2t +++ b/docs/src/INSTALL.t2t @@ -15,7 +15,7 @@ Last update: %%date(%m-%d-%Y) - [gettext http://www.gnu.org/software/gettext/] - [psycopg2 http://freshmeat.net/projects/psycopg/] - [django-simple-history https://bitbucket.org/q/django-simple-history/src] version 1.0 - +- registration To install django-simple-history: ``` diff --git a/ishtar/furnitures/views.py b/ishtar/furnitures/views.py index 60f00ef0e..28e078cd3 100644 --- a/ishtar/furnitures/views.py +++ b/ishtar/furnitures/views.py @@ -1 +1,37 @@ -# Create your views here. +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2010 Étienne Loks + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# See the file COPYING for details. + +""" +Furnitures views +""" + +from django.template import RequestContext +from django.shortcuts import render_to_response + +def get_base_info(request): + dct = {} + return RequestContext(request, dct) + +def index(request): + """ + Main page + """ + dct = get_base_info(request) + return render_to_response('index.html', dct) + diff --git a/ishtar/settings.py.example b/ishtar/settings.py.example index 491412b1b..0b1177830 100644 --- a/ishtar/settings.py.example +++ b/ishtar/settings.py.example @@ -96,7 +96,6 @@ INSTALLED_APPS = ( 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', - # Uncomment the next line to enable admin documentation: - # 'django.contrib.admindocs', + 'registration', 'ishtar.furnitures' ) diff --git a/ishtar/templates/base.html b/ishtar/templates/base.html new file mode 100644 index 000000000..4f8282bbe --- /dev/null +++ b/ishtar/templates/base.html @@ -0,0 +1,34 @@ +{% load i18n %} + + + + + + {% block title %}Ishtar{% endblock %} + + + + + +
+ {% block content %}{% endblock %} +
+ + + + + diff --git a/ishtar/templates/index.html b/ishtar/templates/index.html new file mode 100644 index 000000000..c4c0b0f2a --- /dev/null +++ b/ishtar/templates/index.html @@ -0,0 +1,2 @@ +{% extends "base.html" %} +{% load i18n %} diff --git a/ishtar/templates/registration/activate.html b/ishtar/templates/registration/activate.html new file mode 100644 index 000000000..e85121e05 --- /dev/null +++ b/ishtar/templates/registration/activate.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} + +{% if account %} + +

{% trans "Account successfully activated" %}

+ +

{% trans "Log in" %}

+ +{% else %} + +

{% trans "Account activation failed" %}

+ +{% endif %} + +{% endblock %} diff --git a/ishtar/templates/registration/activation_email.txt b/ishtar/templates/registration/activation_email.txt new file mode 100644 index 000000000..b30035969 --- /dev/null +++ b/ishtar/templates/registration/activation_email.txt @@ -0,0 +1,6 @@ +{% load i18n %} +{% trans "Activate account at" %} {{ site.name }}: + +http://{{ site.domain }}{% url registration_activate activation_key %} + +{% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %} diff --git a/ishtar/templates/registration/activation_email_subject.txt b/ishtar/templates/registration/activation_email_subject.txt new file mode 100644 index 000000000..24f477cbb --- /dev/null +++ b/ishtar/templates/registration/activation_email_subject.txt @@ -0,0 +1 @@ +{% load i18n %}{% trans "Account activation on" %} {{ site.name }} diff --git a/ishtar/templates/registration/login.html b/ishtar/templates/registration/login.html new file mode 100644 index 000000000..8c5c51670 --- /dev/null +++ b/ishtar/templates/registration/login.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +
+
{% csrf_token %} + +{{ form.as_table }} + + +
+
+
+
+

{% trans "Forgot password?" %} {% trans "Reset it" %}

+

{% trans "Not member?" %} {% trans "Register" %}

+
+{% endblock %} diff --git a/ishtar/templates/registration/logout.html b/ishtar/templates/registration/logout.html new file mode 100644 index 000000000..f8da51fa0 --- /dev/null +++ b/ishtar/templates/registration/logout.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +

{% trans "Logged out" %}

+{% endblock %} diff --git a/ishtar/templates/registration/password_change_done.html b/ishtar/templates/registration/password_change_done.html new file mode 100644 index 000000000..659be0a46 --- /dev/null +++ b/ishtar/templates/registration/password_change_done.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +

{% trans "Password changed" %}

+{% endblock %} diff --git a/ishtar/templates/registration/password_change_form.html b/ishtar/templates/registration/password_change_form.html new file mode 100644 index 000000000..ec782424f --- /dev/null +++ b/ishtar/templates/registration/password_change_form.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +
{% csrf_token %} + {{ form.as_p }} + + +
+{% endblock %} diff --git a/ishtar/templates/registration/password_reset_complete.html b/ishtar/templates/registration/password_reset_complete.html new file mode 100644 index 000000000..ef3637c70 --- /dev/null +++ b/ishtar/templates/registration/password_reset_complete.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} + +

{% trans "Password reset successfully" %}

+ +

{% trans "Log in" %}

+ +{% endblock %} diff --git a/ishtar/templates/registration/password_reset_confirm.html b/ishtar/templates/registration/password_reset_confirm.html new file mode 100644 index 000000000..53e1f8359 --- /dev/null +++ b/ishtar/templates/registration/password_reset_confirm.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} + +{% if validlink %} + +
{% csrf_token %} + {{ form.as_p }} + + +
+ +{% else %} + +

{% trans "Password reset failed" %}

+ +{% endif %} + +{% endblock %} diff --git a/ishtar/templates/registration/password_reset_done.html b/ishtar/templates/registration/password_reset_done.html new file mode 100644 index 000000000..6057ccbe1 --- /dev/null +++ b/ishtar/templates/registration/password_reset_done.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +

{% trans "Email with password reset instructions has been sent." %}

+{% endblock %} diff --git a/ishtar/templates/registration/password_reset_email.html b/ishtar/templates/registration/password_reset_email.html new file mode 100644 index 000000000..a55c86958 --- /dev/null +++ b/ishtar/templates/registration/password_reset_email.html @@ -0,0 +1,5 @@ +{% load i18n %} +{% blocktrans %}Reset password at {{ site_name }}{% endblocktrans %}: +{% block reset_link %} +{{ protocol }}://{{ domain }}{% url auth_password_reset_confirm uidb36=uid, token=token %} +{% endblock %} diff --git a/ishtar/templates/registration/password_reset_form.html b/ishtar/templates/registration/password_reset_form.html new file mode 100644 index 000000000..ec782424f --- /dev/null +++ b/ishtar/templates/registration/password_reset_form.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +
{% csrf_token %} + {{ form.as_p }} + + +
+{% endblock %} diff --git a/ishtar/templates/registration/registration_complete.html b/ishtar/templates/registration/registration_complete.html new file mode 100644 index 000000000..3d3d9507b --- /dev/null +++ b/ishtar/templates/registration/registration_complete.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +

{% trans "You are now registered. Activation email sent." %}

+{% endblock %} diff --git a/ishtar/templates/registration/registration_form.html b/ishtar/templates/registration/registration_form.html new file mode 100644 index 000000000..ec782424f --- /dev/null +++ b/ishtar/templates/registration/registration_form.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +
{% csrf_token %} + {{ form.as_p }} + + +
+{% endblock %} diff --git a/ishtar/urls.py b/ishtar/urls.py index 4d921b598..9f58a3e56 100644 --- a/ishtar/urls.py +++ b/ishtar/urls.py @@ -8,11 +8,8 @@ from settings import URL_PATH BASE_URL = r'^' + URL_PATH urlpatterns = patterns('', - # Example: - # (r'^ishtar/', include('ishtar.foo.urls')), - - # Uncomment the admin/doc line below to enable admin documentation: - # (r'^admin/doc/', include('django.contrib.admindocs.urls')), - + (BASE_URL + 'accounts/', include('registration.urls')), (BASE_URL + r'admin/', include(admin.site.urls)), ) +urlpatterns += patterns('ishtar.furnitures.views', + url(BASE_URL + '$', 'index', name='start'),) -- cgit v1.2.3