diff options
author | Sverre Johansen <sverrej@opera.com> | 2009-11-10 23:44:06 +0100 |
---|---|---|
committer | Sverre Johansen <sverrej@opera.com> | 2009-11-11 15:19:12 +0100 |
commit | bece29c1e73e85b87340f9d06f4193242d5a8f0a (patch) | |
tree | 1bd6c3963722c6657b9f721dc42f9c38b804c9a3 | |
parent | 166b5637e89881faed9abde976e64773e314f921 (diff) | |
download | chishop-bece29c1e73e85b87340f9d06f4193242d5a8f0a.tar.bz2 chishop-bece29c1e73e85b87340f9d06f4193242d5a8f0a.tar.xz chishop-bece29c1e73e85b87340f9d06f4193242d5a8f0a.zip |
Added registration through django-registration
-rw-r--r-- | chishop/settings.py | 12 | ||||
-rw-r--r-- | chishop/templates/base.html | 11 | ||||
-rw-r--r-- | chishop/templates/registration/activate.html | 8 | ||||
-rw-r--r-- | chishop/templates/registration/activation_complete.html | 9 | ||||
-rw-r--r-- | chishop/templates/registration/activation_email.txt | 6 | ||||
-rw-r--r-- | chishop/templates/registration/activation_email_subject.txt | 1 | ||||
-rw-r--r-- | chishop/templates/registration/login.html | 8 | ||||
-rw-r--r-- | chishop/templates/registration/logout.html | 7 | ||||
-rw-r--r-- | chishop/templates/registration/registration_complete.html | 8 | ||||
-rw-r--r-- | chishop/templates/registration/registration_form.html | 8 | ||||
-rw-r--r-- | chishop/urls.py | 5 |
11 files changed, 81 insertions, 2 deletions
diff --git a/chishop/settings.py b/chishop/settings.py index 00cf06d..39ddec7 100644 --- a/chishop/settings.py +++ b/chishop/settings.py | |||
@@ -16,6 +16,9 @@ DJANGOPYPI_RELEASE_UPLOAD_TO = 'dists' | |||
16 | # change to False if you do not want Django's default server to serve static pages | 16 | # change to False if you do not want Django's default server to serve static pages |
17 | LOCAL_DEVELOPMENT = True | 17 | LOCAL_DEVELOPMENT = True |
18 | 18 | ||
19 | ACCOUNT_ACTIVATION_DAYS = 7 | ||
20 | LOGIN_REDIRECT_URL = "/" | ||
21 | |||
19 | MANAGERS = ADMINS | 22 | MANAGERS = ADMINS |
20 | 23 | ||
21 | DATABASE_ENGINE = '' | 24 | DATABASE_ENGINE = '' |
@@ -77,6 +80,14 @@ MIDDLEWARE_CLASSES = ( | |||
77 | 80 | ||
78 | ROOT_URLCONF = 'urls' | 81 | ROOT_URLCONF = 'urls' |
79 | 82 | ||
83 | TEMPLATE_CONTEXT_PROCESSORS = ( | ||
84 | "django.core.context_processors.auth", | ||
85 | "django.core.context_processors.debug", | ||
86 | "django.core.context_processors.i18n", | ||
87 | "django.core.context_processors.media", | ||
88 | "django.core.context_processors.request", | ||
89 | ) | ||
90 | |||
80 | TEMPLATE_DIRS = ( | 91 | TEMPLATE_DIRS = ( |
81 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". | 92 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". |
82 | # Always use forward slashes, even on Windows. | 93 | # Always use forward slashes, even on Windows. |
@@ -92,5 +103,6 @@ INSTALLED_APPS = ( | |||
92 | 'django.contrib.admin', | 103 | 'django.contrib.admin', |
93 | 'django.contrib.markup', | 104 | 'django.contrib.markup', |
94 | 'django.contrib.admindocs', | 105 | 'django.contrib.admindocs', |
106 | 'registration', | ||
95 | 'djangopypi', | 107 | 'djangopypi', |
96 | ) | 108 | ) |
diff --git a/chishop/templates/base.html b/chishop/templates/base.html index cc21bf5..2863343 100644 --- a/chishop/templates/base.html +++ b/chishop/templates/base.html | |||
@@ -20,6 +20,16 @@ | |||
20 | {% block site_logo %}{% endblock %} | 20 | {% block site_logo %}{% endblock %} |
21 | <h1 id="site-name">{% block site_name_header %}{% endblock %}</h1> | 21 | <h1 id="site-name">{% block site_name_header %}{% endblock %}</h1> |
22 | </div> | 22 | </div> |
23 | |||
24 | <div id="user-tools"> | ||
25 | {% if user.is_authenticated %} | ||
26 | Welcome, <strong>{{user.username}}</strong>. | ||
27 | <a href="{% url django.contrib.auth.views.logout%}?next={{request.path}}">Log out</a> | ||
28 | {% else %} | ||
29 | <a href="{% url django.contrib.auth.views.login %}?next={{request.path}}">Login</a> / | ||
30 | <a href="{% url registration_register%}">Register</a> | ||
31 | {% endif %} | ||
32 | </div> | ||
23 | </div> | 33 | </div> |
24 | <!-- END Header --> | 34 | <!-- END Header --> |
25 | 35 | ||
@@ -60,4 +70,3 @@ | |||
60 | 70 | ||
61 | </body> | 71 | </body> |
62 | </html> | 72 | </html> |
63 | |||
diff --git a/chishop/templates/registration/activate.html b/chishop/templates/registration/activate.html new file mode 100644 index 0000000..bc67771 --- /dev/null +++ b/chishop/templates/registration/activate.html | |||
@@ -0,0 +1,8 @@ | |||
1 | {% extends "base_site.html" %} | ||
2 | |||
3 | {% block content %} | ||
4 | <h1>Activation Failed</h1> | ||
5 | <p> | ||
6 | Activation with key {{activation_key}} failed. | ||
7 | </p> | ||
8 | {% endblock %} | ||
diff --git a/chishop/templates/registration/activation_complete.html b/chishop/templates/registration/activation_complete.html new file mode 100644 index 0000000..553cf2c --- /dev/null +++ b/chishop/templates/registration/activation_complete.html | |||
@@ -0,0 +1,9 @@ | |||
1 | {% extends "base_site.html" %} | ||
2 | |||
3 | {% block main_content %} | ||
4 | <h1>Activation complete.</h1> | ||
5 | <p> | ||
6 | Hello {{account}}, you are registered. | ||
7 | <a href="/">here</a> to get back to the main page. | ||
8 | </p> | ||
9 | {% endblock %} | ||
diff --git a/chishop/templates/registration/activation_email.txt b/chishop/templates/registration/activation_email.txt new file mode 100644 index 0000000..0a25329 --- /dev/null +++ b/chishop/templates/registration/activation_email.txt | |||
@@ -0,0 +1,6 @@ | |||
1 | Welcome to Chishop. | ||
2 | |||
3 | Please click here to activate your account: | ||
4 | http://{{site}}/accounts/activate/{{activation_key}}/ | ||
5 | |||
6 | Account has to be activated within {{expiration_days}} days. | ||
diff --git a/chishop/templates/registration/activation_email_subject.txt b/chishop/templates/registration/activation_email_subject.txt new file mode 100644 index 0000000..93618cc --- /dev/null +++ b/chishop/templates/registration/activation_email_subject.txt | |||
@@ -0,0 +1 @@ | |||
Account Activation - {{ site }} | |||
diff --git a/chishop/templates/registration/login.html b/chishop/templates/registration/login.html new file mode 100644 index 0000000..6c7f799 --- /dev/null +++ b/chishop/templates/registration/login.html | |||
@@ -0,0 +1,8 @@ | |||
1 | {% extends "base_site.html" %} | ||
2 | |||
3 | {% block content %} | ||
4 | <form method="post" action=""> | ||
5 | {{form.as_p}} | ||
6 | <input type="submit" value="Login"> | ||
7 | </form> | ||
8 | {% endblock %} | ||
diff --git a/chishop/templates/registration/logout.html b/chishop/templates/registration/logout.html new file mode 100644 index 0000000..06483a8 --- /dev/null +++ b/chishop/templates/registration/logout.html | |||
@@ -0,0 +1,7 @@ | |||
1 | {% extends "base_site.html" %} | ||
2 | |||
3 | {% block main_content %} | ||
4 | <p> | ||
5 | {%trans "Logged out."%} | ||
6 | </p> | ||
7 | {% endblock %} | ||
diff --git a/chishop/templates/registration/registration_complete.html b/chishop/templates/registration/registration_complete.html new file mode 100644 index 0000000..d9a19cf --- /dev/null +++ b/chishop/templates/registration/registration_complete.html | |||
@@ -0,0 +1,8 @@ | |||
1 | {% extends "base_site.html" %} | ||
2 | |||
3 | {% block content %} | ||
4 | <h1>Registration complete</h1> | ||
5 | <p> | ||
6 | An activation mail has been sent to you. | ||
7 | </p> | ||
8 | {% endblock %} | ||
diff --git a/chishop/templates/registration/registration_form.html b/chishop/templates/registration/registration_form.html new file mode 100644 index 0000000..719a875 --- /dev/null +++ b/chishop/templates/registration/registration_form.html | |||
@@ -0,0 +1,8 @@ | |||
1 | {% extends "base_site.html" %} | ||
2 | |||
3 | {% block content %} | ||
4 | <h1>Register</h1> | ||
5 | <form method="post" action=""> | ||
6 | {{form.as_p}} | ||
7 | <input type="submit" value="Register"> | ||
8 | {% endblock %} | ||
diff --git a/chishop/urls.py b/chishop/urls.py index b9f3e65..ab2e8a9 100644 --- a/chishop/urls.py +++ b/chishop/urls.py | |||
@@ -18,6 +18,9 @@ urlpatterns += patterns("", | |||
18 | url(r'^admin/doc/', include("django.contrib.admindocs.urls")), | 18 | url(r'^admin/doc/', include("django.contrib.admindocs.urls")), |
19 | url(r'^admin/(.*)', admin.site.root), | 19 | url(r'^admin/(.*)', admin.site.root), |
20 | 20 | ||
21 | # Registration | ||
22 | url(r'^accounts/', include('registration.backends.default.urls')), | ||
23 | |||
24 | # The Chishop | ||
21 | url(r'', include("djangopypi.urls")) | 25 | url(r'', include("djangopypi.urls")) |
22 | ) | 26 | ) |
23 | |||