[snowy] Move users/ to accounts/, tweak templates, add urls
- From: Brad Taylor <btaylor src gnome org>
- To: svn-commits-list gnome org
- Subject: [snowy] Move users/ to accounts/, tweak templates, add urls
- Date: Thu, 23 Jul 2009 14:03:59 +0000 (UTC)
commit 31c674099c137b2a4d4b3c0eefa4f2395820235c
Author: Brad Taylor <brad getcoded net>
Date: Thu Jul 23 10:02:58 2009 -0400
Move users/ to accounts/, tweak templates, add urls
{users => accounts}/__init__.py | 0
{users => accounts}/forms.py | 0
accounts/templates/registration/activate.html | 30 ++++++++++++
.../templates/registration/activation_email.txt | 22 +++++++++
.../registration/activation_email_subject.txt | 2 +
.../templates/registration/login.html | 0
.../templates/registration/logout.html | 0
.../registration/registration_complete.html | 10 ++++
.../templates/registration/registration_form.html | 0
accounts/urls.py | 49 ++++++++++++++++++++
settings.py | 3 +-
urls.py | 41 +---------------
users/templates/registration/activation_email.txt | 1 -
.../registration/activation_email_subject.txt | 1 -
.../registration/registration_complete.html | 4 --
15 files changed, 118 insertions(+), 45 deletions(-)
---
diff --git a/users/__init__.py b/accounts/__init__.py
similarity index 100%
rename from users/__init__.py
rename to accounts/__init__.py
diff --git a/users/forms.py b/accounts/forms.py
similarity index 100%
rename from users/forms.py
rename to accounts/forms.py
diff --git a/accounts/templates/registration/activate.html b/accounts/templates/registration/activate.html
new file mode 100644
index 0000000..5c8ced3
--- /dev/null
+++ b/accounts/templates/registration/activate.html
@@ -0,0 +1,30 @@
+{% extends 'site_base.html' %}
+
+{% load i18n %}
+
+{% block title %}{% trans "Registration complete" %} | {{ block.super }}{% endblock %}
+
+{% block content %}
+{% if account %}
+{% url auth_login as login_url %}
+{% blocktrans with PROJECT_NAME as p and login_url as u %}
+<h1>Welcome to {{ p }}!</h1>
+<p>Your registration is now complete. You may now <a href="{{ u }}">log in</a></p>
+<p>To get more use out of your {{ p }} account, you can configure Tomboy to
+synchronize notes between {{ p }} and your computer.
+<a href="">Find out how</a>.</p>
+{% endblocktrans %}
+{% else %}
+{% blocktrans count expiration_days as days %}
+<h1>Activation failed!</h1>
+Sorry, we were unable to activate your account. Either your activation link
+was incorrect, or the activation key for your account expired. Activation keys
+are only valid for {{ days }} day after registration.
+{% plural %}
+<h1>Activation failed!</h1>
+Sorry, we were unable to activate your account. Either your activation link
+was incorrect, or the activation key for your account expired. Activation keys
+are only valid for {{ days }} days after registration.
+{% endblocktrans %}
+{% endif %}
+{% endblock %}
diff --git a/accounts/templates/registration/activation_email.txt b/accounts/templates/registration/activation_email.txt
new file mode 100644
index 0000000..5d22ac9
--- /dev/null
+++ b/accounts/templates/registration/activation_email.txt
@@ -0,0 +1,22 @@
+{% load i18n %}
+{% blocktrans with site.name as n %}Hello from {{ n }}!{% endblocktrans %}
+
+{% blocktrans %}In order to use your new account, you need to confirm that your email address
+is correct. We'll use this address to send information about your account, and
+announcements of cool new features.{% endblocktrans %}
+
+{% trans "To confirm your email address, go to:" %}
+
+http://{{ site.domain }}{% url registration_activate activation_key %}
+
+{% blocktrans count expiration_days as days %}If you don't, or think you've recieved this email by mistake, the temporary
+account we created for you will be automatically deleted in {{ expiration_days }} day.
+{% plural %}If you don't, or think you've recieved this email by mistake, the temporary
+account we created for you will be automatically deleted in {{ expiration_days }} days.
+{% endblocktrans %}
+
+{% blocktrans with site.name as n %}
+Hope to see you soon!
+
+The {{ n }} Team
+{% endblocktrans %}
diff --git a/accounts/templates/registration/activation_email_subject.txt b/accounts/templates/registration/activation_email_subject.txt
new file mode 100644
index 0000000..4984c59
--- /dev/null
+++ b/accounts/templates/registration/activation_email_subject.txt
@@ -0,0 +1,2 @@
+{% load i18n %}
+{% blocktrans with site.name as n %}{{ n }}: Complete your registration{% endblocktrans %}
diff --git a/users/templates/registration/login.html b/accounts/templates/registration/login.html
similarity index 100%
rename from users/templates/registration/login.html
rename to accounts/templates/registration/login.html
diff --git a/users/templates/registration/logout.html b/accounts/templates/registration/logout.html
similarity index 100%
rename from users/templates/registration/logout.html
rename to accounts/templates/registration/logout.html
diff --git a/accounts/templates/registration/registration_complete.html b/accounts/templates/registration/registration_complete.html
new file mode 100644
index 0000000..908e8d8
--- /dev/null
+++ b/accounts/templates/registration/registration_complete.html
@@ -0,0 +1,10 @@
+{% extends 'site_base.html' %}
+
+{% block content %}
+{% blocktrans with PROJECT_NAME as p %}
+<h1>Your account is pending activation</h1>
+<p>An activation link has been sent to the email address you provided, along
+with instructions for activating your account. Your account must be activated
+before you can use {{ p }}.</p>
+{% endblocktrans %}
+{% endblock %}
diff --git a/users/templates/registration/registration_form.html b/accounts/templates/registration/registration_form.html
similarity index 100%
rename from users/templates/registration/registration_form.html
rename to accounts/templates/registration/registration_form.html
diff --git a/accounts/urls.py b/accounts/urls.py
new file mode 100644
index 0000000..f39f538
--- /dev/null
+++ b/accounts/urls.py
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2009 Brad Taylor <brad getcoded net>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero 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 Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+from snowy.accounts.forms import RegistrationFormUniqueUser
+
+from django.views.generic.simple import direct_to_template
+from django.contrib.auth import views as auth_views
+from django.conf.urls.defaults import *
+
+from registration.views import activate
+from registration.views import register
+
+urlpatterns = patterns('',
+ # Registration URLs
+ url(r'^activate/(?P<activation_key>\w+)/$', activate, name='registration_activate'),
+ url(r'^login/$', auth_views.login, {'template_name': 'registration/login.html'},
+ name='auth_login'),
+ url(r'^logout/$', auth_views.logout, {'template_name': 'registration/logout.html'},
+ name='auth_logout'),
+ url(r'^password/change/$', auth_views.password_change, name='auth_password_change'),
+ url(r'^password/change/done/$', auth_views.password_change_done,
+ name='auth_password_change_done'),
+ url(r'^password/reset/$', auth_views.password_reset, name='auth_password_reset'),
+ url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
+ auth_views.password_reset_confirm, name='auth_password_reset_confirm'),
+ url(r'^password/reset/complete/$', auth_views.password_reset_complete,
+ name='auth_password_reset_complete'),
+ url(r'^password/reset/done/$', auth_views.password_reset_done,
+ name='auth_password_reset_done'),
+ url(r'^register/$', register, {'form_class': RegistrationFormUniqueUser},
+ name='registration_register'),
+ url(r'^register/complete/$', direct_to_template,
+ {'template': 'registration/registration_complete.html'},
+ name='registration_complete'),
+)
diff --git a/settings.py b/settings.py
index 1e6a429..7350cac 100644
--- a/settings.py
+++ b/settings.py
@@ -110,11 +110,12 @@ sys.path.append(EXTERNAL_APPS_PATH)
INSTALLED_APPS = (
# Local apps
'api',
- 'users',
+ 'accounts',
'notes',
# System apps
'django.contrib.admin',
+ 'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
diff --git a/urls.py b/urls.py
index 5990003..f5dea31 100644
--- a/urls.py
+++ b/urls.py
@@ -15,17 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-from django.views.generic.list_detail import object_list, object_detail
from django.views.generic.simple import direct_to_template
-from django.contrib.auth import views as auth_views
from django.conf.urls.defaults import *
-from snowy.users.forms import RegistrationFormUniqueUser
-from snowy.notes.models import Note
-
-from registration.views import activate
-from registration.views import register
-
from django.contrib import admin
admin.autodiscover()
@@ -33,40 +25,13 @@ urlpatterns = patterns('',
url(r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'index.html'},
name='snowy_index'),
- (r'^(?P<username>\w+)/notes/', include('snowy.notes.urls')),
-
(r'^api/', include('snowy.api.urls')),
+ (r'^accounts/', include('snowy.accounts.urls')),
- # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
- # to INSTALLED_APPS to enable admin documentation:
- # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
-
- # Uncomment the next line to enable the admin:
+ (r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
-)
-# Registration URLs
-urlpatterns += patterns('',
- url(r'^registration/activate/(?P<activation_key>\w+)/$', activate, name='registration_activate'),
- url(r'^registration/login/$', auth_views.login, {'template_name': 'registration/login.html'},
- name='auth_login'),
- url(r'^registration/logout/$', auth_views.logout, {'template_name': 'registration/logout.html'},
- name='auth_logout'),
- url(r'^registration/password/change/$', auth_views.password_change, name='auth_password_change'),
- url(r'^registration/password/change/done/$', auth_views.password_change_done,
- name='auth_password_change_done'),
- url(r'^registration/password/reset/$', auth_views.password_reset, name='auth_password_reset'),
- url(r'^registration/password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
- auth_views.password_reset_confirm, name='auth_password_reset_confirm'),
- url(r'^registration/password/reset/complete/$', auth_views.password_reset_complete,
- name='auth_password_reset_complete'),
- url(r'^registration/password/reset/done/$', auth_views.password_reset_done,
- name='auth_password_reset_done'),
- url(r'^registration/register/$', register, {'form_class': RegistrationFormUniqueUser},
- name='registration_register'),
- url(r'^registration/register/complete/$', direct_to_template,
- {'template': 'registration/registration_complete.html'},
- name='registration_complete'),
+ (r'^(?P<username>\w+)/notes/', include('snowy.notes.urls')),
)
from django.conf import settings
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]