{"id":833284,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833284/?format=json","web_url":"http://patchwork.ozlabs.org/project/patchwork/patch/20171102102844.18931-3-stephen@that.guru/","project":{"id":16,"url":"http://patchwork.ozlabs.org/api/1.2/projects/16/?format=json","name":"Patchwork","link_name":"patchwork","list_id":"patchwork.lists.ozlabs.org","list_email":"patchwork@lists.ozlabs.org","web_url":"http://jk.ozlabs.org/projects/patchwork/","scm_url":"git://github.com/getpatchwork/patchwork","webscm_url":"https://github.com/getpatchwork/patchwork","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20171102102844.18931-3-stephen@that.guru>","list_archive_url":null,"date":"2017-11-02T10:28:37","name":"[v2,2/9] urls: Use new login/password change CBVs","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"960c22191b26773c06660770b5c1568636c7a18d","submitter":{"id":69991,"url":"http://patchwork.ozlabs.org/api/1.2/people/69991/?format=json","name":"Stephen Finucane","email":"stephen@that.guru"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/patchwork/patch/20171102102844.18931-3-stephen@that.guru/mbox/","series":[{"id":11467,"url":"http://patchwork.ozlabs.org/api/1.2/series/11467/?format=json","web_url":"http://patchwork.ozlabs.org/project/patchwork/list/?series=11467","date":"2017-11-02T10:28:35","name":"Add support for Django 1.11","version":2,"mbox":"http://patchwork.ozlabs.org/series/11467/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/833284/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833284/checks/","tags":{},"related":[],"headers":{"Return-Path":"<patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","patchwork@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","patchwork@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ySM3W3rn9z9sBd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Nov 2017 21:37:23 +1100 (AEDT)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3ySM3Q6mzJzDr5T\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Nov 2017 21:37:22 +1100 (AEDT)","from butterfly.maple.relay.mailchannels.net\n\t(butterfly.maple.relay.mailchannels.net [23.83.214.27])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3ySM2B0494zDr5T\n\tfor <patchwork@lists.ozlabs.org>;\n\tThu,  2 Nov 2017 21:36:01 +1100 (AEDT)","from relay.mailchannels.net (localhost [127.0.0.1])\n\tby relay.mailchannels.net (Postfix) with ESMTP id C1B745C97C4\n\tfor <patchwork@lists.ozlabs.org>;\n\tThu,  2 Nov 2017 10:29:01 +0000 (UTC)","from one.mxroute.com (unknown [100.96.143.180])\n\t(Authenticated sender: mxroute)\n\tby relay.mailchannels.net (Postfix) with ESMTPA id 56A5D5C98C1\n\tfor <patchwork@lists.ozlabs.org>;\n\tThu,  2 Nov 2017 10:29:01 +0000 (UTC)","from one.mxroute.com (one-outgoing.mxroute.com [172.20.113.32])\n\t(using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)\n\tby 0.0.0.0:2500 (trex/5.9.14); Thu, 02 Nov 2017 10:29:01 +0000"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" (0-bit key;\n\tunprotected) header.d=that.guru header.i=@that.guru\n\theader.b=\"uBWgqleM\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" (0-bit key;\n\tunprotected) header.d=that.guru header.i=@that.guru\n\theader.b=\"uBWgqleM\"; dkim-atps=neutral","ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=that.guru\n\t(client-ip=23.83.214.27; helo=butterfly.maple.relay.mailchannels.net; \n\tenvelope-from=stephen@that.guru; receiver=<UNKNOWN>)","lists.ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" (0-bit key;\n\tunprotected) header.d=that.guru header.i=@that.guru\n\theader.b=\"uBWgqleM\"; dkim-atps=neutral"],"X-Sender-Id":["mxroute|x-authuser|stephen@that.guru","mxroute|x-authuser|stephen@that.guru"],"X-MC-Relay":"Neutral","X-MailChannels-SenderId":"mxroute|x-authuser|stephen@that.guru","X-MailChannels-Auth-Id":"mxroute","X-Harbor-Chemical":"116df0a03daa161d_1509618541601_765228321","X-MC-Loop-Signature":"1509618541601:108230852","X-MC-Ingress-Time":"1509618541601","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru;\n\ts=default;\n\th=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:\n\tSender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:\n\tContent-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:\n\tResent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:\n\tList-Subscribe:List-Post:List-Owner:List-Archive;\n\tbh=kdnUwO6ekcSdvAGxZZqza07n/LSAHPuzz4Qx5h5A5XI=;\n\tb=uBWgqleMX+OB0iFFmtLvhXMRkI\n\toyqctSZ41mKTkBe6X5XiwOAafSETp4n+tWsr2J9Kq7oS9sRi5SqXC481zKSs8ENSHn783tzInNiIF\n\tuUWyhbGsfztYl8kne3wCN/G9/Pbrji3bN9Iv7GUVntijeeNe8k/VZ48wGl4N1ZxEYlvCNfj/gs0Ii\n\taSFL0ujNOVOQfUqBIWHiw7P+eWU0C+TNpjtKDcLvO6XvLvsx6Om2lHGeqHlzPXHzBHswASff14zDl\n\t3I6IXLezctcrsrYoR7qY9lgs43IkhAD2CEDLltoDJhOeGhhYXU4si/oj/J2BIPNcc+dOV8P0m+yBk\n\tWJybdUGA==;","From":"Stephen Finucane <stephen@that.guru>","To":"patchwork@lists.ozlabs.org","Subject":"[PATCH v2 2/9] urls: Use new login/password change CBVs","Date":"Thu,  2 Nov 2017 10:28:37 +0000","Message-Id":"<20171102102844.18931-3-stephen@that.guru>","X-Mailer":"git-send-email 2.13.6","In-Reply-To":"<20171102102844.18931-1-stephen@that.guru>","References":"<20171102102844.18931-1-stephen@that.guru>","X-AuthUser":"stephen@that.guru","X-BeenThere":"patchwork@lists.ozlabs.org","X-Mailman-Version":"2.1.24","Precedence":"list","List-Id":"Patchwork development <patchwork.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/patchwork>,\n\t<mailto:patchwork-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/patchwork/>","List-Post":"<mailto:patchwork@lists.ozlabs.org>","List-Help":"<mailto:patchwork-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/patchwork>,\n\t<mailto:patchwork-request@lists.ozlabs.org?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org","Sender":"\"Patchwork\"\n\t<patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"},"content":"The function based views are deprecated in Django 1.11 [1], so support\nthe newer class based views.\n\n[1] https://docs.djangoproject.com/en/dev/releases/1.11/#id2\n\nSigned-off-by: Stephen Finucane <stephen@that.guru>\n---\n patchwork/urls.py | 94 +++++++++++++++++++++++++++++++++++++++++--------------\n 1 file changed, 70 insertions(+), 24 deletions(-)","diff":"diff --git a/patchwork/urls.py b/patchwork/urls.py\nindex 285d5659..b33b01c4 100644\n--- a/patchwork/urls.py\n+++ b/patchwork/urls.py\n@@ -17,11 +17,13 @@\n # along with Patchwork; if not, write to the Free Software\n # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n \n+import django\n from django.conf import settings\n from django.conf.urls import url, include\n from django.contrib import admin\n from django.contrib.auth import views as auth_views\n \n+from patchwork.compat import reverse\n from patchwork.views import about as about_views\n from patchwork.views import api as api_views\n from patchwork.views import bundle as bundle_views\n@@ -85,32 +87,75 @@ urlpatterns = [\n         name='user-link'),\n     url(r'^user/unlink/(?P<person_id>[^/]+)/$', user_views.unlink,\n         name='user-unlink'),\n+]\n \n-    # password change\n-    url(r'^user/password-change/$', auth_views.password_change,\n-        name='password_change'),\n-    url(r'^user/password-change/done/$', auth_views.password_change_done,\n-        name='password_change_done'),\n-    url(r'^user/password-reset/$', auth_views.password_reset,\n-        name='password_reset'),\n-    url(r'^user/password-reset/mail-sent/$', auth_views.password_reset_done,\n-        name='password_reset_done'),\n-    url(r'^user/password-reset/(?P<uidb64>[0-9A-Za-z_\\-]+)/'\n-        r'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',\n-        auth_views.password_reset_confirm,\n-        name='password_reset_confirm'),\n-    url(r'^user/password-reset/complete/$',\n-        auth_views.password_reset_complete,\n-        name='password_reset_complete'),\n-\n-    # login/logout\n-    url(r'^user/login/$', auth_views.login,\n-        {'template_name': 'patchwork/login.html'},\n-        name='auth_login'),\n-    url(r'^user/logout/$', auth_views.logout,\n-        {'next_page': '/'},\n-        name='auth_logout'),\n+# password change\n+if django.VERSION > (1, 11):\n+    urlpatterns += [\n+        url(r'^user/password-change/$',\n+            auth_views.PasswordChangeView.as_view(),\n+            name='password_change'),\n+        url(r'^user/password-change/done/$',\n+            auth_views.PasswordChangeDoneView.as_view(),\n+            name='password_change_done'),\n+        url(r'^user/password-reset/$',\n+            auth_views.PasswordResetView.as_view(),\n+            name='password_reset'),\n+        url(r'^user/password-reset/mail-sent/$',\n+            auth_views.PasswordResetDoneView.as_view(),\n+            name='password_reset_done'),\n+        url(r'^user/password-reset/(?P<uidb64>[0-9A-Za-z_\\-]+)/'\n+            r'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',\n+            auth_views.PasswordResetConfirmView.as_view(),\n+            name='password_reset_confirm'),\n+        url(r'^user/password-reset/complete/$',\n+            auth_views.PasswordResetCompleteView.as_view(),\n+            name='password_reset_complete'),\n+    ]\n+else:\n+    urlpatterns += [\n+        url(r'^user/password-change/$',\n+            auth_views.password_change,\n+            name='password_change'),\n+        url(r'^user/password-change/done/$',\n+            auth_views.password_change_done,\n+            name='password_change_done'),\n+        url(r'^user/password-reset/$',\n+            auth_views.password_reset,\n+            name='password_reset'),\n+        url(r'^user/password-reset/mail-sent/$',\n+            auth_views.password_reset_done,\n+            name='password_reset_done'),\n+        url(r'^user/password-reset/(?P<uidb64>[0-9A-Za-z_\\-]+)/'\n+            r'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',\n+            auth_views.password_reset_confirm,\n+            name='password_reset_confirm'),\n+        url(r'^user/password-reset/complete/$',\n+            auth_views.password_reset_complete,\n+            name='password_reset_complete'),\n+    ]\n \n+# login/logout\n+if django.VERSION >= (1, 11):\n+    urlpatterns += [\n+        url(r'^user/login/$', auth_views.LoginView.as_view(\n+            template_name='patchwork/login.html'),\n+            name='auth_login'),\n+        url(r'^user/logout/$', auth_views.LogoutView.as_view(\n+            next_page=reverse('project-list')),\n+            name='auth_logout'),\n+    ]\n+else:\n+    urlpatterns += [\n+        url(r'^user/login/$', auth_views.login,\n+            {'template_name': 'patchwork/login.html'},\n+            name='auth_login'),\n+        url(r'^user/logout/$', auth_views.logout,\n+            {'next_page': reverse('project-list')},\n+            name='auth_logout'),\n+    ]\n+\n+urlpatterns += [\n     # registration\n     url(r'^register/', user_views.register, name='user-register'),\n \n@@ -144,6 +189,7 @@ urlpatterns = [\n \n if 'debug_toolbar' in settings.INSTALLED_APPS:\n     import debug_toolbar\n+\n     urlpatterns += [\n         url(r'^__debug__/', include(debug_toolbar.urls)),\n     ]\n","prefixes":["v2","2/9"]}