[extensions-web] django: upgrade to current LTS version 2.2



commit 0e0190ff41de6fd115decc60a1fbd8784a85dcf5
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Tue Apr 2 22:06:15 2019 +0400

    django: upgrade to current LTS version 2.2
    
    1. Upgrade django-contrib-comments to 1.9.1
    2. Upgrade django-registration to 3.0
    3. Pin all dependencies to current latest versions

 requirements.txt                                   | 48 +++++++++++++++++-----
 sweettooth/auth/forms.py                           |  2 +-
 .../activate.html                                  |  0
 .../activation_complete.html                       |  0
 .../activation_email.txt                           |  0
 .../activation_email_subject.txt                   |  0
 .../registration_complete.html                     |  0
 .../registration_form.html                         |  0
 .../{registration => profile}/profile.html         |  0
 .../{registration => profile}/settings.html        |  2 +-
 sweettooth/auth/templates/registration/login.html  |  3 +-
 .../templates/registration/login_popup_form.html   |  2 +-
 .../registration/password_reset_email.txt          |  2 +-
 sweettooth/auth/tests.py                           | 13 ++++--
 sweettooth/auth/urls.py                            | 43 +++++++++++++++----
 sweettooth/auth/views.py                           |  2 +-
 sweettooth/errorreports/tests.py                   |  2 +-
 sweettooth/errorreports/views.py                   |  2 +-
 sweettooth/extensions/models.py                    |  2 +-
 .../extensions/templates/extensions/list.html      |  2 +-
 sweettooth/extensions/tests.py                     |  2 +-
 sweettooth/extensions/views.py                     |  2 +-
 sweettooth/ratings/views.py                        |  2 +-
 sweettooth/review/templates/review/review.html     |  2 +-
 sweettooth/review/views.py                         |  2 +-
 sweettooth/settings.py                             |  3 +-
 sweettooth/templates/base.html                     |  2 +-
 sweettooth/urls.py                                 |  2 +-
 28 files changed, 101 insertions(+), 41 deletions(-)
---
diff --git a/requirements.txt b/requirements.txt
index bd47ef1..fc073bd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,10 +1,38 @@
-Django >= 1.11,<1.12
-django-autoslug >= 1.9
-django-contrib-comments == 1.9.0
-django-registration == 2.5.2
-Pygments >= 1.4
-pillow >= 2.0.0
-polib >= 1.1.0
-chardet >= 2.2.1
-dj-database-url
-dj-email-url
+Django==2.2 \
+    --hash=sha256:7c3543e4fb070d14e10926189a7fcf42ba919263b7473dceaefce34d54e8a119 \
+    --hash=sha256:a2814bffd1f007805b19194eb0b9a331933b82bd5da1c3ba3d7b7ba16e06dc4b
+django-autoslug==1.9.4 \
+    --hash=sha256:08ba143ce5914d2689972c0adaea56abc37fb7175e9f6939fe0e3ac26374e7a0 \
+    --hash=sha256:aece8613eb173854462c656e91d81aa7ddfacaa49fb500d549f2143d1ce48721
+django-contrib-comments==1.9.1 \
+    --hash=sha256:61b051d7bc3ff593e86b41a1ed5e969423cf55cc92768598af3315e2528e0890 \
+    --hash=sha256:656aefe59798e5f7ef06af4bf34cf458962225bce93ca62630ba7dd97df9d81a
+django-registration==3.0 \
+    --hash=sha256:0527be82f3f62233c7b7a4fe6b0217832cbde2c6d8ea5008e8233a764f9a2543 \
+    --hash=sha256:8f1960d1780804b67afb6b202c98cdfaca030a202bc7a263bf80e32f9c8a6984
+Pygments==2.3.1 \
+    --hash=sha256:5ffada19f6203563680669ee7f53b64dabbeb100eb51b61996085e99c03b284a \
+    --hash=sha256:e8218dd399a61674745138520d0d4cf2621d7e032439341bc3f647bff125818d
+Pillow==6.0.0 \
+    --hash=sha256:258d886a49b6b058cd7abb0ab4b2b85ce78669a857398e83e8b8e28b317b5abb \
+    --hash=sha256:2ac36ec56727a95bd5a04dfca6abce1db8042c31ee73b65796a42f31fd52d009 \
+    --hash=sha256:33c79b6dd6bc7f65079ab9ca5bebffb5f5d1141c689c9c6a7855776d1b09b7e8 \
+    --hash=sha256:3c1884ff078fb8bf5f63d7d86921838b82ed4a7d0c027add773c2f38b3168754 \
+    --hash=sha256:44e5240e8f4f8861d748f2a58b3f04daadab5e22bfec896bf5434745f788f33f \
+    --hash=sha256:50fb9e25d25cfcb50b2e6842c4e104e4f0b424be4624e1724532bf005c67589a \
+    --hash=sha256:7eeac51fc37e6b19631a4b8e38b8261a074efcf7cc27fc16a6bee4697af7aaa5 \
+    --hash=sha256:809c0a2ce9032cbcd7b5313f71af4bdc5c8c771cb86eb7559afd954cab82ebb5 \
+    --hash=sha256:9319215530e236822169cbe92426cdc18d16b88c943fdf365a6309a89876e335 \
+    --hash=sha256:e6c0bbf8e277b74196e3140c35f9a1ae3eafd818f7f2d3a15819c49135d6c062
+polib==1.1.0 \
+    --hash=sha256:93b730477c16380c9a96726c54016822ff81acfa553977fdd131f2b90ba858d7 \
+    --hash=sha256:fad87d13696127ffb27ea0882d6182f1a9cf8a5e2b37a587751166c51e5a332a
+chardet==3.0.4 \
+    --hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae \
+    --hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691
+dj-database-url==0.5.0 \
+    --hash=sha256:4aeaeb1f573c74835b0686a2b46b85990571159ffc21aa57ecd4d1e1cb334163 \
+    --hash=sha256:851785365761ebe4994a921b433062309eb882fedd318e1b0fcecc607ed02da9
+dj-email-url==0.1.0 \
+    --hash=sha256:84f32673156f58d740a14cab09f04ca92a65b2c8881b60e31e09e67d7853e544 \
+    --hash=sha256:de8e062c1483d1bfc7a9a185c6601f9c822087bd529756989f81f1dc82855cee
diff --git a/sweettooth/auth/forms.py b/sweettooth/auth/forms.py
index 0f05813..a240654 100644
--- a/sweettooth/auth/forms.py
+++ b/sweettooth/auth/forms.py
@@ -2,7 +2,7 @@
 from django import forms
 from django.contrib.auth import forms as auth_forms
 from django.utils.translation import ugettext_lazy as _
-from registration.forms import RegistrationFormUniqueEmail
+from django_registration.forms import RegistrationFormUniqueEmail
 
 class PlainOutputForm(object):
     def as_plain(self):
diff --git a/sweettooth/auth/templates/registration/activate.html 
b/sweettooth/auth/templates/django_registration/activate.html
similarity index 100%
rename from sweettooth/auth/templates/registration/activate.html
rename to sweettooth/auth/templates/django_registration/activate.html
diff --git a/sweettooth/auth/templates/registration/activation_complete.html 
b/sweettooth/auth/templates/django_registration/activation_complete.html
similarity index 100%
rename from sweettooth/auth/templates/registration/activation_complete.html
rename to sweettooth/auth/templates/django_registration/activation_complete.html
diff --git a/sweettooth/auth/templates/registration/activation_email.txt 
b/sweettooth/auth/templates/django_registration/activation_email.txt
similarity index 100%
rename from sweettooth/auth/templates/registration/activation_email.txt
rename to sweettooth/auth/templates/django_registration/activation_email.txt
diff --git a/sweettooth/auth/templates/registration/activation_email_subject.txt 
b/sweettooth/auth/templates/django_registration/activation_email_subject.txt
similarity index 100%
rename from sweettooth/auth/templates/registration/activation_email_subject.txt
rename to sweettooth/auth/templates/django_registration/activation_email_subject.txt
diff --git a/sweettooth/auth/templates/registration/registration_complete.html 
b/sweettooth/auth/templates/django_registration/registration_complete.html
similarity index 100%
rename from sweettooth/auth/templates/registration/registration_complete.html
rename to sweettooth/auth/templates/django_registration/registration_complete.html
diff --git a/sweettooth/auth/templates/registration/registration_form.html 
b/sweettooth/auth/templates/django_registration/registration_form.html
similarity index 100%
rename from sweettooth/auth/templates/registration/registration_form.html
rename to sweettooth/auth/templates/django_registration/registration_form.html
diff --git a/sweettooth/auth/templates/registration/profile.html 
b/sweettooth/auth/templates/profile/profile.html
similarity index 100%
rename from sweettooth/auth/templates/registration/profile.html
rename to sweettooth/auth/templates/profile/profile.html
diff --git a/sweettooth/auth/templates/registration/settings.html 
b/sweettooth/auth/templates/profile/settings.html
similarity index 53%
rename from sweettooth/auth/templates/registration/settings.html
rename to sweettooth/auth/templates/profile/settings.html
index d156a68..c1a5c32 100644
--- a/sweettooth/auth/templates/registration/settings.html
+++ b/sweettooth/auth/templates/profile/settings.html
@@ -2,6 +2,6 @@
 {% block body %}
   <h3> Settings </h3>
   <ul>
-    <li> <a href="{% url 'auth_password_change' %}">Change your password</a> </li>
+    <li> <a href="{% url 'password_change' %}">Change your password</a> </li>
   </ul>
 {% endblock %}
diff --git a/sweettooth/auth/templates/registration/login.html 
b/sweettooth/auth/templates/registration/login.html
index 8355d46..0ab8608 100644
--- a/sweettooth/auth/templates/registration/login.html
+++ b/sweettooth/auth/templates/registration/login.html
@@ -20,7 +20,7 @@
     </div>
 
     <div class="form-group has-error">
-      {{ form.password.label_tag }} <a class="right" href="{% url 'auth_password_reset' %}">{% trans "Forgot 
your password?" %}</a>
+      {{ form.password.label_tag }} <a class="right" href="{% url 'password_reset' %}">{% trans "Forgot your 
password?" %}</a>
 
       {{ form.password }}
     {% for error in form.password.errors %}
@@ -32,7 +32,6 @@
       <button type="submit" class="btn btn-primary btn-block">{% trans "Log in" %}</button>
     </div>
 </form>
-<!--<a href="{% url 'auth_password_reset' %}">Forgot your password?</a>-->
 <hr>
 <p class="text-center main_feature" style="margin-bottom: 30px;">{% trans "Don't have an account?" %}</p>
 <a href="{% url 'registration_register' %}" class="btn btn-success btn-block no-decoration">{% trans 
"Register" %}</a>
diff --git a/sweettooth/auth/templates/registration/login_popup_form.html 
b/sweettooth/auth/templates/registration/login_popup_form.html
index 42317e0..68e937e 100644
--- a/sweettooth/auth/templates/registration/login_popup_form.html
+++ b/sweettooth/auth/templates/registration/login_popup_form.html
@@ -11,7 +11,7 @@
                 <button type="submit" class="btn btn-primary btn-block">{% trans "Log in" %}</button>
             </div>
             <div class="form-group">
-                <a href="{% url 'auth_password_reset' %}">{% trans "Forgot your password?" %}</a>
+                <a href="{% url 'password_reset' %}">{% trans "Forgot your password?" %}</a>
             </div>
             <li class="divider"></li>
             <p>{% trans "Don't have an account?" %}</p>
diff --git a/sweettooth/auth/templates/registration/password_reset_email.txt 
b/sweettooth/auth/templates/registration/password_reset_email.txt
index 6fc3444..41a2725 100644
--- a/sweettooth/auth/templates/registration/password_reset_email.txt
+++ b/sweettooth/auth/templates/registration/password_reset_email.txt
@@ -1,7 +1,7 @@
 You have requested a password reset on {{ site_name }}. Please follow the link
 to reset your password.
 
-  https://extensions.gnome.org{% url 'auth_password_reset_confirm' uidb64=uid token=token %}
+  https://extensions.gnome.org{% url 'password_reset_confirm' uidb64=uid token=token %}
 
 Thanks!
   the GNOME Shell Extensions team
diff --git a/sweettooth/auth/tests.py b/sweettooth/auth/tests.py
index 816fbf9..627b71d 100644
--- a/sweettooth/auth/tests.py
+++ b/sweettooth/auth/tests.py
@@ -1,14 +1,21 @@
-from registration import validators
-from registration.tests.base import RegistrationTestCase
+from django_registration import validators
 
 from django.contrib.auth import get_user_model
+from django.test.testcases import TestCase
 from django.utils.six import text_type
 from .forms import AutoFocusRegistrationForm
 
 User = get_user_model()
 
 # registration/tests/test_forms.py
-class AuthTests(RegistrationTestCase):
+class AuthTests(TestCase):
+    valid_data = {
+        User.USERNAME_FIELD: 'alice',
+        'email': 'alice example com',
+        'password1': 'swordfish',
+        'password2': 'swordfish',
+    }
+
     def test_email_uniqueness(self):
         User.objects.create(
             username='bob',
diff --git a/sweettooth/auth/urls.py b/sweettooth/auth/urls.py
index ff1d335..0361df6 100644
--- a/sweettooth/auth/urls.py
+++ b/sweettooth/auth/urls.py
@@ -1,27 +1,54 @@
 
 from django.views.generic.base import TemplateView
 from django.conf.urls import url, include
+from django_registration.views import RegistrationView
 from django.contrib.auth import views as auth_views
+from django.contrib.auth.views import LoginView, LogoutView
+from django.urls import reverse_lazy
 from sweettooth.auth import views, forms
-from registration.backends.model_activation.views import RegistrationView
 
 urlpatterns = [
-    url(r'^login/', auth_views.login,
-        dict(template_name='registration/login.html',
-             authentication_form=forms.AuthenticationForm), name='auth-login'),
+    url(r'^login/', LoginView.as_view(form_class=forms.AuthenticationForm), name='auth-login'),
 
     url(r'^change_display_name/(?P<pk>\d+)', views.ajax_change_display_name),
 
-    url(r'^logout/', auth_views.logout,
-        dict(next_page='/'), name='auth-logout'),
+    url(r'^logout/', LogoutView.as_view(next_page='/'), name='auth-logout'),
 
     url(r'^register/$', RegistrationView.as_view(form_class=forms.AutoFocusRegistrationForm),
         name='registration_register'),
 
-    url(r'settings/(?P<user>.+)', TemplateView.as_view(template_name='registration/settings.html'),
+    url(r'settings/(?P<user>.+)', TemplateView.as_view(template_name='profile/settings.html'),
         name='auth-settings'),
 
-    url(r'', include('registration.backends.model_activation.urls')),
+    url(r'', include('django_registration.backends.activation.urls')),
     url(r'^profile/(?P<user>.+)', views.profile, name='auth-profile'),
     url(r'^profile/', views.profile_redirect, name='auth-profile'),
+
+    url(r'^login/$',
+        auth_views.LoginView.as_view(),
+        name='auth-login'),
+    url(r'^logout/$',
+        auth_views.LogoutView.as_view(),
+        name='auth-logout'),
+    url(r'^password/change/$',
+        auth_views.PasswordChangeView.as_view(),
+        name='password_change'),
+    url(r'^password/change/done/$',
+        auth_views.PasswordChangeDoneView.as_view(),
+        name='password_change_done'),
+    url(r'^password/reset/$',
+        auth_views.PasswordResetView.as_view(
+            email_template_name='registration/password_reset_email.txt'
+        ),
+        name='password_reset'),
+    url(r'^password/reset/complete/$',
+        auth_views.PasswordResetCompleteView.as_view(),
+        name='password_reset_complete'),
+    url(r'^password/reset/done/$',
+        auth_views.PasswordResetDoneView.as_view(),
+        name='password_reset_done'),
+    url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/'
+        r'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
+        auth_views.PasswordResetConfirmView.as_view(),
+        name='password_reset_confirm'),
 ]
diff --git a/sweettooth/auth/views.py b/sweettooth/auth/views.py
index 9268cdc..6473886 100644
--- a/sweettooth/auth/views.py
+++ b/sweettooth/auth/views.py
@@ -26,7 +26,7 @@ def profile(request, user):
         waiting = []
 
     return render(request,
-                  'registration/profile.html',
+                  'profile/profile.html',
                   dict(user=userobj,
                        display_name=display_name,
                        extensions=extensions,
diff --git a/sweettooth/errorreports/tests.py b/sweettooth/errorreports/tests.py
index 297666e..62966c8 100644
--- a/sweettooth/errorreports/tests.py
+++ b/sweettooth/errorreports/tests.py
@@ -1,8 +1,8 @@
 
 from django.core import mail
-from django.core.urlresolvers import reverse
 from django.contrib.auth.models import User
 from django.test import TestCase
+from django.urls import reverse
 
 from sweettooth.extensions.models import Extension, ExtensionVersion, STATUS_ACTIVE
 from sweettooth.errorreports import models, views
diff --git a/sweettooth/errorreports/views.py b/sweettooth/errorreports/views.py
index 4d35e1b..3883d81 100644
--- a/sweettooth/errorreports/views.py
+++ b/sweettooth/errorreports/views.py
@@ -3,11 +3,11 @@ from django.conf import settings
 from django.contrib import messages
 from django.contrib.auth.decorators import login_required
 from django.core.mail import send_mail
-from django.core.urlresolvers import reverse
 from django.http import HttpResponseForbidden
 from django.shortcuts import redirect, render
 from django.template import Context
 from django.template.loader import render_to_string
+from django.urls import reverse
 
 from sweettooth.errorreports.models import ErrorReport, error_reported
 from sweettooth.errorreports.forms import ErrorReportForm
diff --git a/sweettooth/extensions/models.py b/sweettooth/extensions/models.py
index 89c71f7..0642e7e 100644
--- a/sweettooth/extensions/models.py
+++ b/sweettooth/extensions/models.py
@@ -3,10 +3,10 @@ import json
 
 from zipfile import ZipFile, BadZipfile
 
-from django.core.urlresolvers import reverse
 from django.contrib.auth.models import User
 from django.db import models
 from django.dispatch import Signal
+from django.urls import reverse
 
 import autoslug
 import re
diff --git a/sweettooth/extensions/templates/extensions/list.html 
b/sweettooth/extensions/templates/extensions/list.html
index 39c315f..2e36d19 100644
--- a/sweettooth/extensions/templates/extensions/list.html
+++ b/sweettooth/extensions/templates/extensions/list.html
@@ -1,5 +1,5 @@
 {% extends "base.html" %}
-{% load static from staticfiles %}
+{% load static from static %}
 {% load i18n %}
 
 {% block body %}
diff --git a/sweettooth/extensions/tests.py b/sweettooth/extensions/tests.py
index e2a1d3d..86397c0 100644
--- a/sweettooth/extensions/tests.py
+++ b/sweettooth/extensions/tests.py
@@ -9,7 +9,7 @@ from zipfile import ZipFile
 
 from django.test import TestCase, TransactionTestCase
 from django.core.files.base import File
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 from sweettooth.extensions import models, views
 
 from sweettooth.testutils import BasicUserTestCase
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 275a522..7f0d1cb 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -4,7 +4,6 @@ from math import ceil
 
 from django.core.exceptions import ValidationError
 from django.core.paginator import Paginator, InvalidPage
-from django.core.urlresolvers import reverse
 from django.contrib.auth.decorators import login_required
 from django.contrib import messages
 from django.db import transaction
@@ -12,6 +11,7 @@ from django.http import HttpResponseBadRequest, HttpResponseForbidden, HttpRespo
 from django.shortcuts import get_object_or_404, redirect, render
 from django.template.loader import render_to_string
 from django.views.decorators.http import require_POST
+from django.urls import reverse
 
 from sweettooth.exceptions import DatabaseErrorWithMessages
 from sweettooth.extensions import models, search
diff --git a/sweettooth/ratings/views.py b/sweettooth/ratings/views.py
index e31b9eb..0c304ff 100644
--- a/sweettooth/ratings/views.py
+++ b/sweettooth/ratings/views.py
@@ -2,9 +2,9 @@
 import json
 
 import django_comments as comments
-from django.core.urlresolvers import reverse
 from django.contrib.messages import info
 from django.shortcuts import redirect
+from django.urls import reverse
 from django.utils.dateformat import format as format_date
 
 from sweettooth.extensions import models
diff --git a/sweettooth/review/templates/review/review.html b/sweettooth/review/templates/review/review.html
index ac7fbd0..e22cbac 100644
--- a/sweettooth/review/templates/review/review.html
+++ b/sweettooth/review/templates/review/review.html
@@ -1,5 +1,5 @@
 {% extends "base.html" %}
-{% load static from staticfiles %}
+{% load static %}
 {% load extension_icon %}
 
 {% block title %}Review "{{ extension.name }}" - {{ block.super }}{% endblock %}
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 425a968..373dec4 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -9,11 +9,11 @@ import pygments.lexers
 import pygments.formatters
 
 from django.core.mail import EmailMessage
-from django.core.urlresolvers import reverse
 from django.http import HttpResponseForbidden, Http404
 from django.shortcuts import redirect, get_object_or_404, render
 from django.template import Context
 from django.template.loader import render_to_string
+from django.urls import reverse
 from django.views.decorators.http import require_POST
 
 from sweettooth.review.diffutils import get_chunks
diff --git a/sweettooth/settings.py b/sweettooth/settings.py
index 6a2f809..ea22459 100644
--- a/sweettooth/settings.py
+++ b/sweettooth/settings.py
@@ -32,7 +32,7 @@ ALLOWED_HOSTS = [os.getenv('EGO_ALLOWED_HOST') or "extensions.gnome.org"]
 INSTALLED_APPS = (
     'django.contrib.auth',
 
-    'registration',
+    'django_registration',
 
     # 'ratings' goes before django's comments
     # app so it will find our templates
@@ -64,7 +64,6 @@ MIDDLEWARE = (
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'django.middleware.security.SecurityMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
-    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
 )
 
diff --git a/sweettooth/templates/base.html b/sweettooth/templates/base.html
index 5e64b89..4b18372 100644
--- a/sweettooth/templates/base.html
+++ b/sweettooth/templates/base.html
@@ -1,4 +1,4 @@
-{% load static from staticfiles %}
+{% load static from static %}
 {% load gravatar %}
 {% load i18n %}
 <!doctype html>
diff --git a/sweettooth/urls.py b/sweettooth/urls.py
index 7867976..d1d3b1e 100644
--- a/sweettooth/urls.py
+++ b/sweettooth/urls.py
@@ -21,7 +21,7 @@ urlpatterns = [
     url(r'^errors/', include('sweettooth.errorreports.urls')),
 
     url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
-    url(r'^admin/', include(admin.site.urls)),
+    url(r'^admin/', admin.site.urls),
     url(r'^comments/', include('sweettooth.ratings.urls')),
     url(r'^comments/', include('django_comments.urls')),
     url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]