├── .gitignore ├── LICENSE ├── README.rst ├── demo ├── demo │ ├── __init__.py │ ├── settings.py │ ├── templates │ │ ├── base.html │ │ └── demo │ │ │ ├── home.html │ │ │ └── profile.html │ ├── urls.py │ ├── views.py │ └── wsgi.py ├── manage.py └── static │ └── css │ └── custom.css ├── registration_bootstrap_3 └── templates │ └── registration │ ├── activate.html │ ├── activation_complete.html │ ├── activation_email.txt │ ├── activation_email_subject.txt │ ├── login.html │ ├── logout.html │ ├── password_change_done.html │ ├── password_change_form.html │ ├── password_reset_complete.html │ ├── password_reset_confirm.html │ ├── password_reset_done.html │ ├── password_reset_form.html │ ├── registration_complete.html │ └── registration_form.html ├── requirements.txt └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.log 3 | *.pot 4 | *.pyc 5 | local_settings.py 6 | demo/db.sqlite3 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Rob Iwancz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Raiders of the Lost Django Registration Templates 2 | ================================================= 3 | 4 | Sample templates for `django-registration 5 | `_ 6 | using `Bootstrap 3 `_ with 7 | the `django-bootstrap3 `_ 8 | template library. 9 | 10 | For more details see: 11 | 12 | http://www.voidynullness.net/blog/2014/01/15/raiders-of-the-lost-django-registration-templates/ 13 | 14 | 15 | Demo 16 | ---- 17 | 18 | The ``demo`` directory contains a simple Django demo website that shows how 19 | everything integrates together. 20 | 21 | 22 | .. image:: screenshot.png 23 | :alt: Screenshot of demo app homepage 24 | 25 | 26 | 27 | License 28 | ------- 29 | 30 | Licensed under the `MIT License `_ 31 | 32 | -------------------------------------------------------------------------------- /demo/demo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robulouski/django-rotldrt/a24caf891f5e5e5d0ea390e10009fcdbdfea9052/demo/demo/__init__.py -------------------------------------------------------------------------------- /demo/demo/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for demo project. 3 | 4 | For more information on this file, see 5 | https://docs.djangoproject.com/en/1.6/topics/settings/ 6 | 7 | For the full list of settings and their values, see 8 | https://docs.djangoproject.com/en/1.6/ref/settings/ 9 | """ 10 | 11 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 12 | import os 13 | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 14 | 15 | 16 | # Quick-start development settings - unsuitable for production 17 | # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ 18 | 19 | # SECURITY WARNING: keep the secret key used in production secret! 20 | SECRET_KEY = '-(y#kx(+4mc7yg7opf=^d6w2s04b5@(1clrt(mnju0(f+26)(-' 21 | 22 | # SECURITY WARNING: don't run with debug turned on in production! 23 | DEBUG = True 24 | 25 | TEMPLATE_DEBUG = True 26 | 27 | ALLOWED_HOSTS = ['localhost', '127.0.0.1',] 28 | 29 | 30 | TEMPLATE_DIRS = ( 31 | '../registration_bootstrap_3/templates/', 32 | ) 33 | 34 | 35 | # Application definition 36 | 37 | INSTALLED_APPS = ( 38 | 'django.contrib.admin', 39 | 'django.contrib.auth', 40 | 'django.contrib.contenttypes', 41 | 'django.contrib.sessions', 42 | 'django.contrib.messages', 43 | 'django.contrib.staticfiles', 44 | 'registration', 45 | 'bootstrap3', 46 | 'demo', 47 | ) 48 | 49 | MIDDLEWARE_CLASSES = ( 50 | 'django.contrib.sessions.middleware.SessionMiddleware', 51 | 'django.middleware.common.CommonMiddleware', 52 | 'django.middleware.csrf.CsrfViewMiddleware', 53 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 54 | 'django.contrib.messages.middleware.MessageMiddleware', 55 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 56 | ) 57 | 58 | ROOT_URLCONF = 'demo.urls' 59 | 60 | WSGI_APPLICATION = 'demo.wsgi.application' 61 | 62 | 63 | # Database 64 | # https://docs.djangoproject.com/en/1.6/ref/settings/#databases 65 | 66 | DATABASES = { 67 | 'default': { 68 | 'ENGINE': 'django.db.backends.sqlite3', 69 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 70 | } 71 | } 72 | 73 | # Internationalization 74 | # https://docs.djangoproject.com/en/1.6/topics/i18n/ 75 | 76 | LANGUAGE_CODE = 'en-us' 77 | 78 | TIME_ZONE = 'Australia/Melbourne' 79 | 80 | USE_I18N = True 81 | 82 | USE_L10N = True 83 | 84 | USE_TZ = True 85 | 86 | 87 | # Static files (CSS, JavaScript, Images) 88 | # https://docs.djangoproject.com/en/1.6/howto/static-files/ 89 | 90 | STATIC_URL = '/static/' 91 | STATICFILES_DIRS = ( 92 | os.path.join(BASE_DIR, "static"), 93 | ) 94 | 95 | # 96 | # Output emails to console for demo purposes. 97 | # 98 | EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' 99 | 100 | 101 | 102 | ACCOUNT_ACTIVATION_DAYS = 3 103 | LOGIN_REDIRECT_URL = '/' 104 | 105 | -------------------------------------------------------------------------------- /demo/demo/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static from staticfiles %} 2 | {% load bootstrap3 %} 3 | 4 | 5 | 6 | 7 | 8 | 9 | {% block title %}{% endblock %} 10 | {% bootstrap_css %} 11 | 12 | 13 | 14 | 15 |
16 | 47 | {% block content %} 48 | {% endblock %} 49 | 50 |
51 | 52 | 60 | 61 | {% bootstrap_javascript jquery=True %} 62 | 63 | 64 | -------------------------------------------------------------------------------- /demo/demo/templates/demo/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load bootstrap3 %} 3 | {% block title %}DEMO{% endblock %} 4 | {% block nav_user %} 5 | {% if user.is_authenticated %} 6 | 14 | {% else %} 15 | 24 | {% endif %} 25 | {% endblock %} 26 | {% block content %} 27 |
28 |
29 |
30 |

DEMO

31 |

django-registration demo using Bootstrap 3

32 | {% if not user.is_authenticated %} 33 |

Register 35 |   36 | Sign in 38 |

39 | {% endif %} 40 |
41 |
42 |
43 | {% endblock content %} 44 | -------------------------------------------------------------------------------- /demo/demo/templates/demo/profile.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load admin_urls %} 3 | {% load bootstrap3 %} 4 | {% block title %}Profile{% endblock %} 5 | {% block content %} 6 |
7 |

Profile

8 |

{{ user.get_username }}

9 |

{{ user.get_full_name }}

10 |

Change password

11 |
12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /demo/demo/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, include, url 2 | from django.contrib.auth import views as auth_views 3 | 4 | from django.contrib import admin 5 | admin.autodiscover() 6 | 7 | urlpatterns = patterns('', 8 | url(r'^admin/', include(admin.site.urls)), 9 | url(r'^accounts/', include('registration.backends.default.urls')), 10 | # Password URL workarounds for Django 1.6: 11 | # http://stackoverflow.com/questions/19985103/ 12 | url(r'^password/change/$', 13 | auth_views.password_change, 14 | name='password_change'), 15 | url(r'^password/change/done/$', 16 | auth_views.password_change_done, 17 | name='password_change_done'), 18 | url(r'^password/reset/$', 19 | auth_views.password_reset, 20 | name='password_reset'), 21 | url(r'^accounts/password/reset/done/$', 22 | auth_views.password_reset_done, 23 | name='password_reset_done'), 24 | url(r'^password/reset/complete/$', 25 | auth_views.password_reset_complete, 26 | name='password_reset_complete'), 27 | url(r'^password/reset/confirm/(?P[0-9A-Za-z_\-]+)/(?P.+)/$', 28 | auth_views.password_reset_confirm, 29 | name='password_reset_confirm'), 30 | # ------------------------------------------------------ 31 | url(r'^$', 'demo.views.home', name='home'), 32 | url(r'^profile/$', 'demo.views.profile', name='profile'), 33 | ) 34 | -------------------------------------------------------------------------------- /demo/demo/views.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from django.shortcuts import render 3 | from django.contrib.auth.views import login 4 | from django.contrib.auth.decorators import login_required 5 | 6 | 7 | def home(request): 8 | if (request.user.is_authenticated()): 9 | return render(request, 'demo/home.html') 10 | return login(request, template_name='demo/home.html') 11 | 12 | @login_required 13 | def profile(request): 14 | return render(request, template_name='demo/profile.html') 15 | -------------------------------------------------------------------------------- /demo/demo/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for demo project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demo.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | -------------------------------------------------------------------------------- /demo/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demo.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /demo/static/css/custom.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; 3 | } 4 | .wrapper { 5 | min-height: 100%; 6 | height: auto !important; 7 | height: 100%; 8 | margin: 0 auto -100px; /* the bottom margin is the negative value of the footer's height */ 9 | } 10 | 11 | .wrapper:after { 12 | content: ""; 13 | display: block; 14 | } 15 | 16 | #page-footer, .wrapper:after { 17 | height: 100px; /* '.push' must be the same height as 'footer' */ 18 | } 19 | 20 | #page-footer { 21 | border-top: 2px solid rgb(218, 218, 218); 22 | background-color: rgb(238, 238, 238); 23 | text-shadow: rgb(217, 217, 217) 1px 1px 0px 24 | } 25 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/activate.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | 4 | {% block title %}Account activation error{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |

Account activation error

10 |
11 |

The activation key {{ activation_key }} is invalid or expired.

12 |
13 |
14 |
15 | 16 | {% endblock %} 17 | 18 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/activation_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Account activation complete{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

Success!

8 |

Account successfully activated!

9 |

You can now sign in to the website.

10 | 11 |

Sign in 14 |

15 |
16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/activation_email.txt: -------------------------------------------------------------------------------- 1 | You are receiving this email because you have signed up for an account at {{ site.name }}. 2 | 3 | To activate your account, please visit the following page: 4 | 5 | http://{{ site.domain }}{% url 'registration_activate' activation_key %} 6 | 7 | This page will expire in {{ expiration_days }} day{{ expiration_days|pluralize }}. 8 | 9 | If you did not sign up for this account you do not need to take any further 10 | action -- you can simply delete this email. 11 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/activation_email_subject.txt: -------------------------------------------------------------------------------- 1 | {{ site.name }}: Please activate your account. 2 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load bootstrap3 %} 3 | 4 | {% block title %}Sign in{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |
10 |

Sign in

11 |

Not yet registered? 12 | Register now for free!

13 |

Trouble signing in? 14 | Reset password.

15 |
16 |
17 | 18 | {% if form.errors %} 19 |
20 |
21 |

Login failed. Try again...

22 |
23 |
24 | {% endif %} 25 | 26 |
30 | {% csrf_token %} 31 | 32 | {% bootstrap_field form.username layout='horizontal' %} 33 | {% bootstrap_field form.password layout='horizontal' %} 34 | {% if next %} 35 | 36 | {% else %} 37 | 38 | {% endif %} 39 | {% buttons %} 40 |
41 | 44 |
45 | {% endbuttons %} 46 |
47 | 48 |
49 | {% endblock %} 50 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/logout.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load bootstrap3 %} 3 | 4 | {% block title %}Login{% endblock %} 5 | 6 | {% block content %} 7 |
8 |

Logout

9 |

You are now logged out.

10 |

Home

11 |
12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/password_change_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Password change complete{% endblock %} 4 | 5 | {% block content %} 6 |
7 |
8 |
9 |

Password changed!

10 |

Password successfully changed.

11 |

Profile

12 |

Home

13 |
14 |
15 |
16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/password_change_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load bootstrap3 %} 3 | 4 | {% block title %}Change Password{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |
10 |

Change Password

11 |
12 |
13 | 14 |
15 | {% csrf_token %} 16 | {% bootstrap_form form layout='horizontal' %} 17 | 18 | {% buttons %} 19 |
20 | 21 |
22 | {% endbuttons %} 23 |
24 |
25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Password reset complete{% endblock %} 4 | 5 | {% block content %} 6 |
7 |
8 |
9 |

Password reset complete

10 |

Password successfully reset.

11 |

Sign in 12 |

Home

13 |
14 |
15 |
16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/password_reset_confirm.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load bootstrap3 %} 3 | 4 | {% block title %}Password reset{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |
10 |

Password reset

11 |
12 |
13 | 14 | {% if validlink %} 15 |
16 | {% csrf_token %} 17 | {% bootstrap_form form layout='horizontal' %} 18 | 19 | {% buttons %} 20 |
21 | 24 |
25 | {% endbuttons %} 26 |
27 | 28 | {% else %} 29 | 30 |
31 |
32 |

Password reset failed!

33 |
34 |
35 |
36 |
37 |

The password reset link was invalid, 38 | possibly because it has already been used.

39 |

Sign in 40 |

41 |
42 | 43 | {% endif %} 44 | 45 |
46 | {% endblock %} 47 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Password reset successful{% endblock %} 4 | 5 | {% block content %} 6 |
7 |
8 |
9 |

Password has been reset!

10 |

An email with instructions for setting a new password has been sent.

11 |
12 |
13 |
14 | {% endblock %} 15 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/password_reset_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load bootstrap3 %} 3 | 4 | {% block title %}Password Reset{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |
10 |

Password Reset

11 |
12 |
13 | 14 |
16 | {% csrf_token %} 17 | {% bootstrap_form form layout='horizontal' %} 18 | 19 | {% buttons %} 20 |
21 | 22 |
23 | {% endbuttons %} 24 |
25 | 26 |
27 | {% endblock %} 28 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/registration_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Registration complete{% endblock %} 4 | 5 | {% block content %} 6 |
7 |
8 |
9 |

Registration complete!

10 | 11 |

An activation email has been sent.

12 |
13 |
14 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /registration_bootstrap_3/templates/registration/registration_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load bootstrap3 %} 3 | 4 | {% block title %}Registration{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |
10 |

Sign up

11 |

Already registered? 12 | Sign in here.

13 |
14 |
15 | 16 |
18 | {% csrf_token %} 19 | {% bootstrap_form form layout='horizontal' %} 20 | 21 | {% buttons %} 22 |
23 | 26 |
27 | {% endbuttons %} 28 |
29 | 30 |
31 | {% endblock %} 32 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django==1.6.1 2 | argparse==1.2.1 3 | distribute==0.6.24 4 | django-bootstrap3==2.5.5 5 | django-registration==1.0 6 | wsgiref==0.1.2 7 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robulouski/django-rotldrt/a24caf891f5e5e5d0ea390e10009fcdbdfea9052/screenshot.png --------------------------------------------------------------------------------