Mercurial > hg > savane-forge
changeset 170:3ddd86437b55
Integrate django-registration in the project (TODO: auto-create an ExtendedUser)
author | Sylvain Beucler <beuc@beuc.net> |
---|---|
date | Thu, 22 Jul 2010 20:13:23 +0200 |
parents | 15d698645728 |
children | 95cf3d737dbf |
files | .gitignore INSTALL TODO doc/DJANGO registration settings_default.py templates/base.html templates/registration/README templates/registration/activate.html templates/registration/activation_complete.html templates/registration/activation_email.txt templates/registration/activation_email_subject.txt templates/registration/registration_complete.html templates/registration/registration_form.html urls.py |
diffstat | 15 files changed, 87 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ # Bundled dependencies, cf. INSTALL django-annoying +django-registration
--- a/INSTALL +++ b/INSTALL @@ -26,6 +26,7 @@ apt-get install python-django python-mysqldb mysql-server hg clone http://bitbucket.org/offline/django-annoying/ +hg clone http://bitbucket.org/ubernostrum/django-registration/ * Install process
--- a/TODO +++ b/TODO @@ -11,7 +11,9 @@ improve it. -[/] Implement web screens (higher priority) +[/] Implement high priority web screens + + [/] User account registration [/] User page @@ -32,8 +34,6 @@ [X] GPG key - [ ] Resume and skills - [/] My Groups [ ] Group membership (manage members, manage permissions, request @@ -44,21 +44,21 @@ [ ] Project registration -[ ] Implement web screens (lower priority) +[ ] Implement lower priority web screens - [ ] Account conf 2 ([ ] profile/resume, [ ] skills, [ ] timezone) + [ ] Account conf part 2 ([ ] profile/resume, [ ] skills, [ ] timezone) [ ] Bookmarks? Was considered for deletion at a point in Savane: http://gna.org/task/?1412 - note that yeupou is a bit partial towards trackers in that discussion -[X] Admin interface (implemented via Django admin) +[/] Admin interface (implemented via Django admin) [ ] News management (+ comments) [/] Work on the web design - [X] Do something different + [/] Do something different [ ] Maybe we can change the colors. @@ -77,7 +77,7 @@ [/] homedirs and .ssh replication (done in savane-cleanup, and in Python - just adapt the DB schema) - [ ] GPG keyrings + [/] GPG keyrings [ ] Group resources (Download, CVS, SVN, Arch, Git, Mercurial, Bazaar)
--- a/doc/DJANGO +++ b/doc/DJANGO @@ -24,3 +24,8 @@ and voluntarily released that way without so much of a release note. Don't rely on it. http://code.djangoproject.com/ticket/11293 + +- With Django 1.2 and above, you can add to you settings.py: + EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + This will direct all mails to the console, which means you won't + risk sending real e-mails to real people by mistake when testing.
new file mode 120000 --- /dev/null +++ b/registration @@ -0,0 +1,1 @@ +django-registration/registration \ No newline at end of file
--- a/settings_default.py +++ b/settings_default.py @@ -87,6 +87,8 @@ 'django.contrib.admin', 'django.contrib.admindocs', + 'registration', + 'savane.svmain', 'savane.my', 'savane.register', @@ -117,3 +119,9 @@ #REQUIRE_LOGIN_PATH = LOGIN_URL #STATIC_MEDIA_URL = subdir + '/static_media/' #MEDIA_URL = subdir + '/upload/' + + +# 3rd-party configuration + +# django-registration +ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window
--- a/templates/base.html +++ b/templates/base.html @@ -20,12 +20,15 @@ <li class="menuitem"><a href="{% url savane.my.views.index %}">My account</a></li> <li class="menuitem"><a href="{% url django.contrib.auth.views.logout %}">Logout</a></li> {% else %} + <li class="menutitle">Login status</li> + <li class="menuitem"><span class="error">Not connected</span></li> <li class="menuitem"><a href="{% url django.contrib.auth.views.login %}">Login</a></li> + <li class="menuitem"><a href="{% url registration_register %}">New user</a></li> {% endif %} <!-- /sitemenu --> - <li class="menutitle">Site Help</li> - <li class="menuitem"><a href="{% url contact %}">Contact Us</a></li> + <li class="menutitle">Site help</li> + <li class="menuitem"><a href="{% url contact %}">Contact us</a></li> </ul> <div class="main"><a name="top"></a>
--- a/templates/registration/README +++ b/templates/registration/README @@ -1,3 +1,5 @@ 'registration/login.html' is the place where Django (more precisely 'django.contrib.auth.views.login') looks for the login template by default. + +Other templates are required by the 'django-registration' application.
new file mode 100644 --- /dev/null +++ b/templates/registration/activate.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} + +{% trans "Your account activation failed." %} + +{% endblock content %}
new file mode 100644 --- /dev/null +++ b/templates/registration/activation_complete.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} + +{% trans "Your account is now active." %} + +{% endblock content %}
new file mode 100644 --- /dev/null +++ b/templates/registration/activation_email.txt @@ -0,0 +1,17 @@ +{% load i18n %} + +{% trans "Here's your activation key" %} +{{activation_key}} + +{% trans "Please click on this link to activate your account" %} +http://{{site}}{% url registration_activate activation_key %} + +{% trans "This link will expire in:" %} {{expiration_days}} {% trans "days." %} + +{% comment %} +http://docs.djangoproject.com/en/dev/ref/contrib/sites/ +{{site}} +{{site.name}} +{{site.domain}} +(by default name == domain) +{% endcomment %}
new file mode 100644 --- /dev/null +++ b/templates/registration/activation_email_subject.txt @@ -0,0 +1,1 @@ +Savane account registration
new file mode 100644 --- /dev/null +++ b/templates/registration/registration_complete.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} + +{% trans "An email containing account-activation information has been sent." %} + +{% endblock content %}
new file mode 100644 --- /dev/null +++ b/templates/registration/registration_form.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% block content %} + +<form action="" method="POST">{% csrf_token %} + <table> + {{ form.as_table }} + </table> + <input type="submit" /> +</form> + +{% endblock content %}
--- a/urls.py +++ b/urls.py @@ -33,6 +33,8 @@ # Generic login/logout/change_pass/etc. (r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page' : '/'}), # redirect to '/' instead of login page + # django-registration + (r'^accounts/', include('registration.backends.default.urls')), (r'^accounts/', include('django.contrib.auth.urls')), )