diff --git a/.gitignore b/.gitignore index 41969a4..5401dde 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build/ .DS_Store MANIFEST dist +.idea diff --git a/README.rst b/README.rst index 97dc2c4..6666289 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ django-registration-defaults ============================ -James Bennet's `django-registration `_ +James Bennet's `django-registration `_ is awesome. But it doesn't come with any of the 15 templates required to implement the workflow of registration, login/logout, and password changing and resetting. This application simply provides a set of default templates for @@ -53,7 +53,7 @@ You can add the templates in one of two ways: "registration_defaults", "django.contrib.admin", ... - "registration", + "django_registration", ) 2. Alternatively, if ``django.template.loaders.filesystem.Loader`` is @@ -73,16 +73,16 @@ Base templates ~~~~~~~~~~~~~~ All ``registration_defaults`` templates inherit from -``registration/registration_base.html``. The default template provided for +``django_registration/registration_base.html``. The default template provided for this is simply:: {% extends "base.html" %} You must either provide a ``base.html`` for the registration templates to -inherit from, or override ``registration/registration_base.html``. The base +inherit from, or override ``django_registration/registration_base.html``. The base template should provide a ``title`` block for the content of the HTML title, and a ``content`` block for content (NOTE: this has changed from previously -using ``body`` to be more in line with `reusable app standards +using ``body`` to be more in line with `reusable app standards `_ ). For example:: diff --git a/registration_defaults/templates/registration/activation_complete.html b/registration_defaults/templates/django_registration/activation_complete.html similarity index 75% rename from registration_defaults/templates/registration/activation_complete.html rename to registration_defaults/templates/django_registration/activation_complete.html index c2ab8dd..a832188 100644 --- a/registration_defaults/templates/registration/activation_complete.html +++ b/registration_defaults/templates/django_registration/activation_complete.html @@ -1,11 +1,9 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Activation complete" %}{% endblock %} {% block content %} -{% url 'auth_login' as auth_login_url %} +{% url 'login' as auth_login_url %} {% blocktrans %} Thanks, activation complete! You may now login using the username and password you set at registration. {% endblocktrans %} {% endblock %} - - diff --git a/registration_defaults/templates/registration/activation_email.txt b/registration_defaults/templates/django_registration/activation_email_body.txt similarity index 80% rename from registration_defaults/templates/registration/activation_email.txt rename to registration_defaults/templates/django_registration/activation_email_body.txt index 9ca54b3..6298d3c 100644 --- a/registration_defaults/templates/registration/activation_email.txt +++ b/registration_defaults/templates/django_registration/activation_email_body.txt @@ -1,15 +1,15 @@ {% load i18n %} -{% url 'registration_activate' activation_key as activation_key_url%} +{% url 'django_registration_activate' activation_key as activation_key_url%} {% blocktrans with sitename=site.name siteurl=site.domain %} You (or someone pretending to be you) have asked to register an account at {{ sitename }}. If this wasn't you, please ignore this email and your address will be removed from our records. -To activate this account, please click the following link within the next +To activate this account, please click the following link within the next {{ expiration_days }} days: http://{{ siteurl }}{{ activation_key_url }} Sincerely, {{ sitename }} Management -{% endblocktrans %} \ No newline at end of file +{% endblocktrans %} diff --git a/registration_defaults/templates/registration/activation_email_subject.txt b/registration_defaults/templates/django_registration/activation_email_subject.txt similarity index 100% rename from registration_defaults/templates/registration/activation_email_subject.txt rename to registration_defaults/templates/django_registration/activation_email_subject.txt diff --git a/registration_defaults/templates/django_registration/activation_failed.html b/registration_defaults/templates/django_registration/activation_failed.html new file mode 100644 index 0000000..bd51e40 --- /dev/null +++ b/registration_defaults/templates/django_registration/activation_failed.html @@ -0,0 +1,8 @@ +User activation failed. Please contact {{ sitename }} for more information. + +{% comment %} + +TODO: Add more info from the activation_error dict. +See https://django-registration.readthedocs.io/en/3.0/quickstart.html#django-registration-activation-failed-html + +{% endcomment %} diff --git a/registration_defaults/templates/registration/registration_base.html b/registration_defaults/templates/django_registration/registration_base.html similarity index 100% rename from registration_defaults/templates/registration/registration_base.html rename to registration_defaults/templates/django_registration/registration_base.html diff --git a/registration_defaults/templates/django_registration/registration_closed.html b/registration_defaults/templates/django_registration/registration_closed.html new file mode 100644 index 0000000..dfe2197 --- /dev/null +++ b/registration_defaults/templates/django_registration/registration_closed.html @@ -0,0 +1,6 @@ +{% extends "django_registration/registration_base.html" %} +{% load i18n %} +{% block title %}{% trans "Registration closed" %}{% endblock %} +{% block content %} +{% blocktrans %}Registration is closed for this site.{% endblocktrans %} +{% endblock %} diff --git a/registration_defaults/templates/registration/registration_complete.html b/registration_defaults/templates/django_registration/registration_complete.html similarity index 81% rename from registration_defaults/templates/registration/registration_complete.html rename to registration_defaults/templates/django_registration/registration_complete.html index 872292b..b0f8749 100644 --- a/registration_defaults/templates/registration/registration_complete.html +++ b/registration_defaults/templates/django_registration/registration_complete.html @@ -1,4 +1,4 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Activation email sent" %}{% endblock %} {% block content %} diff --git a/registration_defaults/templates/registration/registration_form.html b/registration_defaults/templates/django_registration/registration_form.html similarity index 84% rename from registration_defaults/templates/registration/registration_form.html rename to registration_defaults/templates/django_registration/registration_form.html index 6ca5759..2194b7e 100644 --- a/registration_defaults/templates/registration/registration_form.html +++ b/registration_defaults/templates/django_registration/registration_form.html @@ -1,4 +1,4 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Register for an account" %}{% endblock %} {% block content %} diff --git a/registration_defaults/templates/registration/activate.html b/registration_defaults/templates/registration/activate.html deleted file mode 100644 index 4f3bdbe..0000000 --- a/registration_defaults/templates/registration/activate.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} -{% block title %}{% if account %}{% trans "Activation complete" %}{% else %}{% trans "Activation problem" %}{% endif %}{% endblock %} -{% block content %} -{% url 'auth_login' as auth_login_url %} -{% if account %} -{% blocktrans %} -Thanks {{ account }}, activation complete! -You may now login using the username and password you set at registration. -{% endblocktrans %} -{% else %} -{% blocktrans %}Oops – it seems that your activation key is invalid. Please check the url again.{% endblocktrans %} -{% endif %} -{% endblock %} diff --git a/registration_defaults/templates/registration/activation_email.html b/registration_defaults/templates/registration/activation_email.html deleted file mode 100644 index c6ebc26..0000000 --- a/registration_defaults/templates/registration/activation_email.html +++ /dev/null @@ -1,26 +0,0 @@ -{% load i18n %} -{% comment %} -This template is used for the html alternative of the activation email -if you use a django-registration backend that looks for it. e.g. -https://github.com/huseyinyilmaz/django-registration-extended-backend -{% endcomment %} -{% url 'registration_activate' activation_key as activation_key_url %} -{% blocktrans with sitename=site.name sitedomain=site.domain%} -

Account registration for {{ sitename }}

-

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

-

-To activate this account, please click the following link within the next -{{ expiration_days }} days:
-http://{{ sitedomain }}{{ activation_key_url }} -

-

-Sincerely,
-{{ sitename }} Management -

- -{% endblocktrans %} \ No newline at end of file diff --git a/registration_defaults/templates/registration/logged_out.html b/registration_defaults/templates/registration/logged_out.html new file mode 100644 index 0000000..f9b51d4 --- /dev/null +++ b/registration_defaults/templates/registration/logged_out.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}Logged out{% endblock %} + +{% block content %} + +

{% trans "Thanks for spending some quality time with the website today." %}

+ +

{% trans 'Return to the home page' %}

+ +

{% trans 'Log in again' %}

+ +{% endblock %} diff --git a/registration_defaults/templates/registration/login.html b/registration_defaults/templates/registration/login.html index 2fd6edb..e816287 100644 --- a/registration_defaults/templates/registration/login.html +++ b/registration_defaults/templates/registration/login.html @@ -1,15 +1,26 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Login" %}{% endblock %} {% block content %} -{% url 'auth_password_reset' as auth_pwd_reset_url %} -{% url 'registration_register' as register_url%} +{% url 'password_reset' as auth_pwd_reset_url %} +{% url 'django_registration_register' as register_url%} {% if form.errors %} -

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

+ {% for field in form %} + {% for error in field.errors %} +
  • {% blocktrans %}{{ error }}{% endblocktrans %}
  • + {% endfor %} + {% endfor %} + {% if form.non_field_errors %} +
      + {% for error in form.non_field_errors %} +
    • {% blocktrans %}{{ error }}{% endblocktrans %}
    • + {% endfor %} +
    + {% endif %} {% endif %} -
    {% csrf_token %} +{% csrf_token %} @@ -20,11 +31,16 @@
    {% trans form.username.label_tag %}{{ form.password }}
    -

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

    +

    {% blocktrans %}Forgot your password?{% endblocktrans %}

    +{# NOTE: settings is not put into the template by default, you have to override the login view with extra_context #} +{# See https://docs.djangoproject.com/en/2.2/topics/auth/default/#django.contrib.auth.views.LoginView #} +{% if settings.REGISTRATION_OPEN %} +

    {% blocktrans %}Need an account?{% endblocktrans %}

    +{% endif %} + {% endblock %} diff --git a/registration_defaults/templates/registration/logout.html b/registration_defaults/templates/registration/logout.html index 6759e11..1f1768f 100644 --- a/registration_defaults/templates/registration/logout.html +++ b/registration_defaults/templates/registration/logout.html @@ -1,4 +1,4 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Logged out" %}{% endblock %} {% block content %} diff --git a/registration_defaults/templates/registration/password_change_done.html b/registration_defaults/templates/registration/password_change_done.html index d49d6cc..7ae2520 100644 --- a/registration_defaults/templates/registration/password_change_done.html +++ b/registration_defaults/templates/registration/password_change_done.html @@ -1,4 +1,4 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Password changed" %}{% endblock %} {% block content %} diff --git a/registration_defaults/templates/registration/password_change_form.html b/registration_defaults/templates/registration/password_change_form.html index 9e04d04..8a1fd4b 100644 --- a/registration_defaults/templates/registration/password_change_form.html +++ b/registration_defaults/templates/registration/password_change_form.html @@ -1,4 +1,4 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Change password" %}{% endblock %} {% block content %} diff --git a/registration_defaults/templates/registration/password_reset_complete.html b/registration_defaults/templates/registration/password_reset_complete.html index 064701e..cb591ca 100644 --- a/registration_defaults/templates/registration/password_reset_complete.html +++ b/registration_defaults/templates/registration/password_reset_complete.html @@ -1,4 +1,4 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Password reset complete" %}{% endblock %} {% block content %}{% blocktrans %} diff --git a/registration_defaults/templates/registration/password_reset_confirm.html b/registration_defaults/templates/registration/password_reset_confirm.html index 5006abd..0c7a40c 100644 --- a/registration_defaults/templates/registration/password_reset_confirm.html +++ b/registration_defaults/templates/registration/password_reset_confirm.html @@ -1,4 +1,4 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Confirm password reset" %}{% endblock %} {% block content %} diff --git a/registration_defaults/templates/registration/password_reset_done.html b/registration_defaults/templates/registration/password_reset_done.html index 9d283e3..6c9e780 100644 --- a/registration_defaults/templates/registration/password_reset_done.html +++ b/registration_defaults/templates/registration/password_reset_done.html @@ -1,4 +1,4 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Password reset" %}{% endblock %} {% block content %} diff --git a/registration_defaults/templates/registration/password_reset_email.html b/registration_defaults/templates/registration/password_reset_email.html index 287737f..b26fd8a 100644 --- a/registration_defaults/templates/registration/password_reset_email.html +++ b/registration_defaults/templates/registration/password_reset_email.html @@ -1,17 +1,17 @@ {% load i18n %}{% trans "Greetings" %} {% if user.get_full_name %}{{ user.get_full_name }}{% else %}{{ user }}{% endif %}, {% blocktrans %}You are receiving this email because you (or someone pretending to be you) -requested that your password be reset on the {{ domain }} site. If you do not +requested that your password be reset on the {{ domain }} site. If you do not wish to reset your password, please ignore this message. To reset your password, please click the following link, or copy and paste it into your web browser:{% endblocktrans %} -{{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uid token %} +{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uid token %} {% blocktrans with username=user.username %} Your username, in case you've forgotten: {{ username }} Best regards, {{ site_name }} Management -{% endblocktrans %} \ No newline at end of file +{% endblocktrans %} diff --git a/registration_defaults/templates/registration/password_reset_form.html b/registration_defaults/templates/registration/password_reset_form.html index 35811fe..b695da4 100644 --- a/registration_defaults/templates/registration/password_reset_form.html +++ b/registration_defaults/templates/registration/password_reset_form.html @@ -1,4 +1,4 @@ -{% extends "registration/registration_base.html" %} +{% extends "django_registration/registration_base.html" %} {% load i18n %} {% block title %}{% trans "Reset password" %}{% endblock %} {% block content %}{% blocktrans %} diff --git a/setup.py b/setup.py index 018edc4..0281533 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from distutils.core import setup -VERSION = '0.4.4' +VERSION = '0.4.6' setup( name='django-registration-defaults', @@ -13,7 +13,7 @@ " on ``django-registration``.", author="Charlie DeTar", author_email="cfd@media.mit.edu", - url="http://github.com/yourcelf/django-registration-defaults", + url="http://github.com/dfrankow/django-registration-defaults", license="MIT License", platforms=["any"], classifiers=[ @@ -26,8 +26,8 @@ "Framework :: Django", ], install_requires=[ - 'Django>=1.5', - 'django-registration>=1.0', + 'Django>=2.1', + 'django-registration>=3.0', ], packages=['registration_defaults'], package_dir={'registration_defaults': 'registration_defaults'},