Skip to content

Commit

Permalink
Support django-registration >3, update paths
Browse files Browse the repository at this point in the history
  • Loading branch information
henrinie committed Mar 14, 2020
1 parent d9a37d4 commit 4f81daa
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion signbank/customregistration/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.utils.translation import ugettext_lazy as _

from registration.forms import RegistrationFormTermsOfService
from django_registration.forms import RegistrationFormTermsOfService


class CustomUserForm(RegistrationFormTermsOfService):
Expand Down
2 changes: 1 addition & 1 deletion signbank/customregistration/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _

from registration.signals import user_registered
from django_registration.signals import user_registered
from notifications.signals import notify


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h4>{% blocktrans %}Comments{% endblocktrans %} ({{comment_count}})</h4>
{% blocktrans %}Add comment{% endblocktrans %}</button>
</form>
{% else %}
<p>Please <a href="{% url 'auth_login' %}">log in</a> to leave a comment.</p>
<p>Please <a href="{% url 'login' %}">log in</a> to leave a comment.</p>
{% endif %}
</div>
</div>
7 changes: 4 additions & 3 deletions signbank/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.contrib.sitemaps.views import sitemap

# Views
from registration.backends.hmac.views import RegistrationView
from django_registration.backends.activation.views import RegistrationView
from .dictionary.adminviews import GlossListView
from .tools import infopage
from django.contrib.flatpages import views as flatpages_views
Expand Down Expand Up @@ -43,8 +43,9 @@
name='sign_search'),

# Registration urls for login, logout, registration, activation etc.
path('accounts/register/', RegistrationView.as_view(form_class=CustomUserForm), name='registration_register',),
path('accounts/', include('registration.backends.hmac.urls')),
path('accounts/register/', RegistrationView.as_view(form_class=CustomUserForm), name='django_registration_register',),
path('accounts/', include('django_registration.backends.activation.urls')),
path('accounts/', include('django.contrib.auth.urls')),

# Django-contrib-comments urls
path('comments/', include('django_comments.urls')),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "registration/registration_base.html" %}
{% extends "django_registration/registration_base.html" %}
{% load i18n %}

{% block bootstrap3_title %}{% blocktrans %}Activation Failure{% endblocktrans %} | {% endblock %}
Expand All @@ -11,7 +11,7 @@ <h3>{% trans "Account activation failed." %}</h3>


{% comment %}
**registration/activate.html**
**django_registration/activate.html**

Used if account activation fails. With the default setup, has the following context:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "registration/registration_base.html" %}
{% extends "django_registration/registration_base.html" %}
{% load i18n %}

{% block bootstrap3_title %}{% blocktrans %}Activation Complete{% endblocktrans %} | {% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To activate this account, please click the following link within the next
{{ expiration_days }} days:
{% endblocktrans %}

http{% if request.is_secure %}s{% endif %}://{{site.domain}}{% url 'registration_activate' activation_key %}
http{% if request.is_secure %}s{% endif %}://{{site.domain}}{% url 'django_registration_activate' activation_key %}

{% blocktrans with site_name=site.name %}
Sincerely,
Expand All @@ -18,7 +18,7 @@ The {{ site_name }} Team


{% comment %}
**registration/activation_email.txt**
**django_registration/activation_email.txt**

Used to generate the text body of the activation email. Should display a
link the user can click to activate the account. This template has the
Expand Down Expand Up @@ -48,5 +48,5 @@ following context:
``HttpRequest`` instance for better flexibility.
For example it can be used to compute absolute register URL:

{{ request.scheme }}://{{ request.get_host }}{% url 'registration_activate' activation_key %}
{{ request.scheme }}://{{ request.get_host }}{% url 'django_registration_activate' activation_key %}
{% endcomment %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uidb64=uid token=token %}
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% trans "Your username, in case you've forgotten:" %} {{ user.get_username }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "registration/registration_base.html" %}
{% extends "django_registration/registration_base.html" %}
{% load bootstrap3 %}
{% load i18n %}

Expand All @@ -10,7 +10,7 @@
<h3>{% blocktrans %}Create account{% endblocktrans%}</h3>
<div class="panel panel-default">
<div class="panel-body">
{% include 'registration/registration_info.html' %}
{% include 'django_registration/registration_info.html' %}
</div>
</div>
<div class="panel panel-default">
Expand All @@ -27,7 +27,7 @@ <h4 class="panel-title">{% blocktrans %}Terms of service{% endblocktrans %}</h4>
</div>
<div class="panel-body">
<h4>{% blocktrans %}By creating an account on this site you (the "user") agree to the following conditions:{% endblocktrans %}</h4>
{% include 'registration/terms_of_service.html' %}
{% include 'django_registration/terms_of_service.html' %}
</div>
</div>
{% bootstrap_field form.tos %}
Expand All @@ -45,7 +45,7 @@ <h3>{% blocktrans %}Error{% endblocktrans %}</h3>


{% comment %}
**registration/registration_form.html**
**django_registration/registration_form.html**
Used to show the form users will fill out to register. By default, has
the following context:

Expand Down
2 changes: 1 addition & 1 deletion templates/flatpages/tos.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
<div class="col-md-10 col-md-offset-1">
<h3>{% blocktrans %}Terms of Service{% endblocktrans %}</h3>
{% include "registration/terms_of_service.html" %}
{% include "django_registration/terms_of_service.html" %}
</div>
</div>
{% endblock %}
Expand Down
8 changes: 4 additions & 4 deletions templates/langbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
<li><a href="{% url 'admin:index' %}">{% blocktrans %}Django admin{% endblocktrans %}</a></li>
<li role="separator" class="divider"></li>
{% endif %}
<li><a href="{% url 'auth_password_change' %}">{% blocktrans %}Change password{% endblocktrans %}</a></li>
<li><a href="{% url 'password_change' %}">{% blocktrans %}Change password{% endblocktrans %}</a></li>
<li role="separator" class="divider"></li>
<li><a href="{% url 'auth_logout' %}"><span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
<li><a href="{% url 'logout' %}"><span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
{% blocktrans %}Sign out{% endblocktrans %}</a></li>
</ul>
</div>
{% else %}
{# Translators: Sign in link #}
<a class="btn btn-default" role="button" href="{% url 'auth_login' %}">
<a class="btn btn-default" role="button" href="{% url 'login' %}">
{% blocktrans %}Sign in{% endblocktrans %}</a>
<a class="btn btn-primary" role="button" href="{% url 'registration_register' %}">
<a class="btn btn-primary" role="button" href="{% url 'django_registration_register' %}">
{% blocktrans %}Create account{% endblocktrans %}
</a>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "registration/registration_base.html" %}
{% extends "django_registration/registration_base.html" %}
{% load i18n %}

{% block bootstrap3_title %}{% blocktrans %}Logged Out{% endblocktrans %} | {% endblock %}
Expand Down
10 changes: 5 additions & 5 deletions templates/registration/login.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "registration/registration_base.html" %}
{% extends "django_registration/registration_base.html" %}
{% load bootstrap3 %}
{% load i18n %}

Expand All @@ -18,9 +18,9 @@ <h3>{% blocktrans %}Sign in{% endblocktrans %}</h3>
<input type="hidden" name="next" value="{{ next }}">
</form>
<hr>
<p><strong>{% trans "Forgot your password?" %}</strong> <a href="{% url 'auth_password_reset' %}" class="btn btn-warning"
<p><strong>{% trans "Forgot your password?" %}</strong> <a href="{% url 'password_reset' %}" class="btn btn-warning"
role="button">{% trans "Reset password" %}</a></p>
<p><strong>{% trans "Not a member?" %}</strong> <a href="{% url 'registration_register' %}" class="btn btn-info"
<p><strong>{% trans "Not a member?" %}</strong> <a href="{% url 'django_registration_register' %}" class="btn btn-info"
role="button">{% trans "Create account" %}</a></p>
</div>

Expand All @@ -31,10 +31,10 @@ <h3>{% blocktrans %}Sign in{% endblocktrans %}</h3>
{% endblock %}

{% comment %}
**registration/login.html**
**django_registration/login.html**

It's your responsibility to provide the login form in a template called
registration/login.html by default. This template gets passed four
django_registration/login.html by default. This template gets passed four
template context variables:

``form``
Expand Down

0 comments on commit 4f81daa

Please sign in to comment.