├── .gitignore ├── README.rst ├── registration_defaults ├── __init__.py ├── settings.py └── templates │ └── registration │ ├── activate.html │ ├── activation_complete.html │ ├── activation_email.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_email.html │ ├── password_reset_form.html │ ├── registration_base.html │ ├── registration_complete.html │ └── registration_form.html └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.pyc 3 | *.swp 4 | .DS_Store 5 | MANIFEST 6 | dist 7 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | django-registration-defaults 2 | ============================ 3 | 4 | James Bennet's `django-registration `_ 5 | is awesome. But it doesn't come with any of the 15 templates required to 6 | implement the workflow of registration, login/logout, and password changing and 7 | resetting. This application simply provides a set of default templates for 8 | this to avoid the repetition of rewriting them. 9 | 10 | This app is supplemental to ``django-registration``, which must also be 11 | installed. 12 | 13 | Installation 14 | ~~~~~~~~~~~~ 15 | 16 | Install using your preferred method for python modules. The folder 17 | ``registration_defaults`` must end up in your python path. You could do this 18 | by copying or symlinking the folder into your path, or with:: 19 | 20 | python setup.py install 21 | 22 | My preferred method (and that of many django developers) is to install from the 23 | git source using `pip `_ with `virtualenv 24 | `_. The `requirements file 25 | `_ entry for this (and the 26 | dependency ``django-registration``) is as follows:: 27 | 28 | django-registration 29 | django-registration-defaults 30 | 31 | Setup 32 | ~~~~~ 33 | 34 | Configuration parameters required by ``django-registration`` are set in the 35 | module ``registration_defaults.settings``. Add these by importing them into 36 | your settings file:: 37 | 38 | from registration_defaults.settings import * 39 | 40 | You can add the templates in one of two ways: 41 | 42 | 1. If you're using the ``django.template.loaders.app_directories.Loader`` 43 | template loader (it is enabled by default), you can include the 44 | templates by adding ``"registration_defaults"`` to your project's 45 | ``INSTALLED_APPS`` setting. Keep in mind that ``admin`` defines some 46 | templates for changing and retrieving passwords, so if you want to use 47 | consistent base templates and styling for all registration and 48 | login/logout functions, you should add ``registration_defaults`` before 49 | ``django.contrib.admin`` so that it will take precedence:: 50 | 51 | INSTALLED_APPS = ( 52 | ... 53 | "registration_defaults", 54 | "django.contrib.admin", 55 | ... 56 | "registration", 57 | ) 58 | 59 | 2. Alternatively, if ``django.template.loaders.filesystem.Loader`` is 60 | listed before the app directories loader, you can add 61 | ``REGISTRATION_TEMPLATE_DIR`` to your ``TEMPLATE_DIRS`` setting. If you 62 | do this, it is not necessary to include ``registration_defaults`` as an 63 | installed app:: 64 | 65 | from registration_defaults.settings import * 66 | 67 | TEMPLATE_DIRS = ( 68 | ... 69 | REGISTRATION_TEMPLATE_DIR, 70 | ) 71 | 72 | Base templates 73 | ~~~~~~~~~~~~~~ 74 | 75 | All ``registration_defaults`` templates inherit from 76 | ``registration/registration_base.html``. The default template provided for 77 | this is simply:: 78 | 79 | {% extends "base.html" %} 80 | 81 | You must either provide a ``base.html`` for the registration templates to 82 | inherit from, or override ``registration/registration_base.html``. The base 83 | template should provide a ``title`` block for the content of the HTML title, 84 | and a ``content`` block for content (NOTE: this has changed from previously 85 | using ``body`` to be more in line with `reusable app standards 86 | `_ ). For example:: 87 | 88 | 89 | 90 | 91 | {% block title %}{% endblock %} 92 | 93 | 94 | {% block content %}{% endblock %} 95 | 96 | 97 | 98 | Bugs, improvements 99 | ================== 100 | 101 | Please contribute any improvements or bugs to the `github project page 102 | `_ 103 | 104 | Thanks! 105 | 106 | Copying 107 | ======= 108 | 109 | Copyright (c) 2010 Charlie DeTar 110 | 111 | Permission is hereby granted, free of charge, to any person obtaining a copy 112 | of this software and associated documentation files (the "Software"), to deal 113 | in the Software without restriction, including without limitation the rights 114 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 115 | copies of the Software, and to permit persons to whom the Software is 116 | furnished to do so, subject to the following conditions: 117 | 118 | The above copyright notice and this permission notice shall be included in 119 | all copies or substantial portions of the Software. 120 | 121 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 122 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 123 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 124 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 125 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 126 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 127 | THE SOFTWARE. 128 | -------------------------------------------------------------------------------- /registration_defaults/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yourcelf/django-registration-defaults/0a101c9eeb0f0beabfb5e7d5adc82d19ffa2a305/registration_defaults/__init__.py -------------------------------------------------------------------------------- /registration_defaults/settings.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | ACCOUNT_ACTIVATION_DAYS = 2 4 | REGISTRATION_TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "templates") 5 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/activate.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% if account %}{% trans "Activation complete" %}{% else %}{% trans "Activation problem" %}{% endif %}{% endblock %} 4 | {% block content %} 5 | {% url 'auth_login' as auth_login_url %} 6 | {% if account %} 7 | {% blocktrans %} 8 | Thanks {{ account }}, activation complete! 9 | You may now login using the username and password you set at registration. 10 | {% endblocktrans %} 11 | {% else %} 12 | {% blocktrans %}Oops – it seems that your activation key is invalid. Please check the url again.{% endblocktrans %} 13 | {% endif %} 14 | {% endblock %} 15 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/activation_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Activation complete" %}{% endblock %} 4 | {% block content %} 5 | {% url 'auth_login' as auth_login_url %} 6 | {% blocktrans %} 7 | Thanks, activation complete! You may now login using the username and password you set at registration. 8 | {% endblocktrans %} 9 | {% endblock %} 10 | 11 | 12 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/activation_email.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% comment %} 3 | This template is used for the html alternative of the activation email 4 | if you use a django-registration backend that looks for it. e.g. 5 | https://github.com/huseyinyilmaz/django-registration-extended-backend 6 | {% endcomment %} 7 | {% url 'registration_activate' activation_key as activation_key_url %} 8 | {% blocktrans with sitename=site.name sitedomain=site.domain%} 9 |

Account registration for {{ sitename }}

10 |

11 | You (or someone pretending to be you) have asked to register an account at 12 | {{ sitename }}.
13 | If this wasn't you, please ignore this email and your address will be removed 14 | from our records. 15 |

16 |

17 | To activate this account, please click the following link within the next 18 | {{ expiration_days }} days:
19 | http://{{ sitedomain }}{{ activation_key_url }} 20 |

21 |

22 | Sincerely,
23 | {{ sitename }} Management 24 |

25 | 26 | {% endblocktrans %} -------------------------------------------------------------------------------- /registration_defaults/templates/registration/activation_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% url 'registration_activate' activation_key as activation_key_url%} 3 | {% blocktrans with sitename=site.name siteurl=site.domain %} 4 | You (or someone pretending to be you) have asked to register an account at 5 | {{ sitename }}. If this wasn't you, please ignore this email 6 | and your address will be removed from our records. 7 | 8 | To activate this account, please click the following link within the next 9 | {{ expiration_days }} days: 10 | 11 | http://{{ siteurl }}{{ activation_key_url }} 12 | 13 | Sincerely, 14 | {{ sitename }} Management 15 | {% endblocktrans %} -------------------------------------------------------------------------------- /registration_defaults/templates/registration/activation_email_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans with sitename=site.name %}Account registration for {{ sitename }}{% endblocktrans %} 2 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Login" %}{% endblock %} 4 | {% block content %} 5 | {% url 'auth_password_reset' as auth_pwd_reset_url %} 6 | {% url 'registration_register' as register_url%} 7 | 8 | {% if form.errors %} 9 |

{% blocktrans %}Your username and password didn't match. Please try again.{% endblocktrans %}

10 | {% endif %} 11 | 12 |
{% csrf_token %} 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
{% trans form.username.label_tag %}{{ form.username }}
{% trans form.password.label_tag %}{{ form.password }}
23 |

{% blocktrans %}Forgot your password? 24 | Need an account?{% endblocktrans %}

25 | 26 | 27 | 28 |
29 | 30 | {% endblock %} 31 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/logout.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Logged out" %}{% endblock %} 4 | {% block content %} 5 | {% trans "Successfully logged out!" %} 6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/password_change_done.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Password changed" %}{% endblock %} 4 | {% block content %} 5 | {% trans "Password successfully changed!" %} 6 | {% endblock %} 7 | 8 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/password_change_form.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Change password" %}{% endblock %} 4 | {% block content %} 5 |
{% csrf_token %} 6 | 7 | {{ form }} 8 | 9 |
10 |
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Password reset complete" %}{% endblock %} 4 | {% block content %}{% blocktrans %} 5 | Your password has been reset! You may now log in. 6 | {% endblocktrans %}{% endblock %} 7 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/password_reset_confirm.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Confirm password reset" %}{% endblock %} 4 | {% block content %} 5 | {% trans "Enter your new password below to reset your password:" %} 6 |
{% csrf_token %} 7 | 8 | {{ form.as_table }} 9 | 10 |
11 |
12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Password reset" %}{% endblock %} 4 | {% block content %} 5 |

6 | {% blocktrans %}We have sent you an email with a link to reset your password. 7 | Please check your email and click the link to continue.{% endblocktrans %} 8 |

9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/password_reset_email.html: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% trans "Greetings" %} {% if user.get_full_name %}{{ user.get_full_name }}{% else %}{{ user }}{% endif %}, 2 | 3 | {% blocktrans %}You are receiving this email because you (or someone pretending to be you) 4 | requested that your password be reset on the {{ domain }} site. If you do not 5 | wish to reset your password, please ignore this message. 6 | 7 | To reset your password, please click the following link, or copy and paste it 8 | into your web browser:{% endblocktrans %} 9 | 10 | {{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uid token %} 11 | 12 | {% blocktrans with username=user.username %} 13 | Your username, in case you've forgotten: {{ username }} 14 | 15 | Best regards, 16 | {{ site_name }} Management 17 | {% endblocktrans %} -------------------------------------------------------------------------------- /registration_defaults/templates/registration/password_reset_form.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Reset password" %}{% endblock %} 4 | {% block content %}{% blocktrans %} 5 | Forgot your password? Enter your email in the form below and we'll send you 6 | instructions for creating a new one.{% endblocktrans %} 7 |
{% csrf_token %} 8 | 9 | {{ form }} 10 | 11 |
12 |
13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/registration_base.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load i18n %} 3 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/registration_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Activation email sent" %}{% endblock %} 4 | {% block content %} 5 | {% blocktrans %}An activation email has been sent. 6 | Please check your email and click on the link to activate your account.{% endblocktrans %} 7 | {% endblock %} 8 | 9 | -------------------------------------------------------------------------------- /registration_defaults/templates/registration/registration_form.html: -------------------------------------------------------------------------------- 1 | {% extends "registration/registration_base.html" %} 2 | {% load i18n %} 3 | {% block title %}{% trans "Register for an account" %}{% endblock %} 4 | {% block content %} 5 | 6 | {% csrf_token %} 7 | {{ form }} 8 | 9 | 10 |
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | 3 | VERSION = '0.4.4' 4 | 5 | setup( 6 | name='django-registration-defaults', 7 | version=VERSION, 8 | description="Default templates and settings for James Bennett's" 9 | "django-registration application.", 10 | long_description="This module provides a full set of default templates" 11 | " and settings for ``django-registration`` to ease the process of" 12 | " creating Django apps that require user registration. It depends" 13 | " on ``django-registration``.", 14 | author="Charlie DeTar", 15 | author_email="cfd@media.mit.edu", 16 | url="http://github.com/yourcelf/django-registration-defaults", 17 | license="MIT License", 18 | platforms=["any"], 19 | classifiers=[ 20 | "Development Status :: 3 - Alpha", 21 | "Environment :: Web Environment", 22 | "Intended Audience :: Developers", 23 | "License :: OSI Approved :: MIT License", 24 | "Operating System :: OS Independent", 25 | "Programming Language :: Python", 26 | "Framework :: Django", 27 | ], 28 | install_requires=[ 29 | 'Django>=1.5', 30 | 'django-registration>=1.0', 31 | ], 32 | packages=['registration_defaults'], 33 | package_dir={'registration_defaults': 'registration_defaults'}, 34 | package_data={'registration_defaults': ['templates/*/*.html', 'templates/*/*.txt']}, 35 | include_package_data=True, 36 | zip_safe=False, 37 | ) 38 | --------------------------------------------------------------------------------