diff --git a/plinth/menu.py b/plinth/menu.py
index efbca2a09..1a50c33e7 100644
--- a/plinth/menu.py
+++ b/plinth/menu.py
@@ -15,7 +15,7 @@
# along with this program. If not, see .
#
-from django.core.urlresolvers import reverse
+from django.urls import reverse
class Menu(object):
diff --git a/plinth/middleware.py b/plinth/middleware.py
index 0e4ce15bb..8223095fc 100644
--- a/plinth/middleware.py
+++ b/plinth/middleware.py
@@ -19,8 +19,8 @@
Django middleware to show pre-setup message and setup progress.
"""
+from django import urls
from django.contrib import messages
-from django.core import urlresolvers
from django.utils.translation import ugettext_lazy as _
import logging
@@ -41,8 +41,8 @@ class SetupMiddleware(object):
# Perform a URL resolution. This is slightly inefficient as
# Django will do this resolution again.
try:
- resolver_match = urlresolvers.resolve(request.path_info)
- except urlresolvers.Resolver404:
+ resolver_match = urls.resolve(request.path_info)
+ except urls.Resolver404:
return
if not resolver_match.namespaces or not len(resolver_match.namespaces):
diff --git a/plinth/modules/disks/views.py b/plinth/modules/disks/views.py
index a5186a17f..032c92e31 100644
--- a/plinth/modules/disks/views.py
+++ b/plinth/modules/disks/views.py
@@ -20,9 +20,9 @@ Views for disks module.
"""
from django.contrib import messages
-from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.template.response import TemplateResponse
+from django.urls import reverse
from django.utils.translation import ugettext as _
from plinth.modules import disks as disks_module
diff --git a/plinth/modules/dynamicdns/dynamicdns.py b/plinth/modules/dynamicdns/dynamicdns.py
index 79b9a9e4d..6111b3a2a 100644
--- a/plinth/modules/dynamicdns/dynamicdns.py
+++ b/plinth/modules/dynamicdns/dynamicdns.py
@@ -18,7 +18,7 @@
from django import forms
from django.contrib import messages
from django.core import validators
-from django.core.urlresolvers import reverse_lazy
+from django.urls import reverse_lazy
from django.utils.translation import ugettext as _, ugettext_lazy
from django.template.response import TemplateResponse
import logging
diff --git a/plinth/modules/first_boot/middleware.py b/plinth/modules/first_boot/middleware.py
index aa7050cd8..069a3f728 100644
--- a/plinth/modules/first_boot/middleware.py
+++ b/plinth/modules/first_boot/middleware.py
@@ -20,8 +20,8 @@ Django middleware to redirect to firstboot wizard if it has not be run
yet.
"""
-from django.core.urlresolvers import reverse
from django.http.response import HttpResponseRedirect
+from django.urls import reverse
import logging
from plinth import kvstore
@@ -48,7 +48,8 @@ class FirstBootMiddleware(object):
if state >= 10 and user_requests_firstboot:
return HttpResponseRedirect(reverse('index'))
- # Setup is not complete: Forbid accessing anything but firstboot or help
+ # Setup is not complete: Forbid accessing anything but
+ # firstboot or help
if state < 10 and not user_requests_firstboot and \
not user_requests_help:
return HttpResponseRedirect(reverse('first_boot:state%d' % state))
diff --git a/plinth/modules/first_boot/views.py b/plinth/modules/first_boot/views.py
index 937a03d42..bff4ecc0c 100644
--- a/plinth/modules/first_boot/views.py
+++ b/plinth/modules/first_boot/views.py
@@ -17,9 +17,9 @@
from django.contrib import messages
from django.contrib.auth.models import User
-from django.core.urlresolvers import reverse_lazy
from django.http.response import HttpResponseRedirect
from django.shortcuts import render
+from django.urls import reverse_lazy
from django.utils.translation import ugettext as _
from django.views.generic import CreateView, FormView, TemplateView
diff --git a/plinth/modules/ikiwiki/views.py b/plinth/modules/ikiwiki/views.py
index 89ebab841..44a092ca6 100644
--- a/plinth/modules/ikiwiki/views.py
+++ b/plinth/modules/ikiwiki/views.py
@@ -20,9 +20,9 @@ Plinth module for configuring ikiwiki
"""
from django.contrib import messages
-from django.core.urlresolvers import reverse_lazy
from django.shortcuts import redirect
from django.template.response import TemplateResponse
+from django.urls import reverse_lazy
from django.utils.translation import ugettext as _, ugettext_lazy
from plinth import actions
diff --git a/plinth/modules/letsencrypt/views.py b/plinth/modules/letsencrypt/views.py
index c2a5ffbbd..f9551be45 100644
--- a/plinth/modules/letsencrypt/views.py
+++ b/plinth/modules/letsencrypt/views.py
@@ -20,9 +20,9 @@ Plinth module for using Let's Encrypt.
"""
from django.contrib import messages
-from django.core.urlresolvers import reverse_lazy
from django.shortcuts import redirect
from django.template.response import TemplateResponse
+from django.urls import reverse_lazy
from django.utils.translation import ugettext as _
from django.views.decorators.http import require_POST
import json
diff --git a/plinth/modules/monkeysphere/views.py b/plinth/modules/monkeysphere/views.py
index d74899919..bc559d6e9 100644
--- a/plinth/modules/monkeysphere/views.py
+++ b/plinth/modules/monkeysphere/views.py
@@ -20,9 +20,9 @@ Views for the monkeysphere module.
"""
from django.contrib import messages
-from django.core.urlresolvers import reverse_lazy
from django.shortcuts import redirect
from django.template.response import TemplateResponse
+from django.urls import reverse_lazy
from django.utils.translation import ugettext as _
from django.views.decorators.http import require_POST
import json
diff --git a/plinth/modules/networks/networks.py b/plinth/modules/networks/networks.py
index 272de3587..bad776c38 100644
--- a/plinth/modules/networks/networks.py
+++ b/plinth/modules/networks/networks.py
@@ -16,9 +16,9 @@
#
from django.contrib import messages
-from django.core.urlresolvers import reverse_lazy
from django.shortcuts import redirect
from django.template.response import TemplateResponse
+from django.urls import reverse_lazy
from django.utils.translation import ugettext as _, ugettext_lazy
from django.views.decorators.http import require_POST
from logging import Logger
diff --git a/plinth/modules/pagekite/views.py b/plinth/modules/pagekite/views.py
index 583f072dc..46854e254 100644
--- a/plinth/modules/pagekite/views.py
+++ b/plinth/modules/pagekite/views.py
@@ -15,9 +15,9 @@
# along with this program. If not, see .
#
-from django.core.urlresolvers import reverse, reverse_lazy
from django.http.response import HttpResponseRedirect
from django.template.response import TemplateResponse
+from django.urls import reverse, reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.generic import View, TemplateView
from django.views.generic.edit import FormView
diff --git a/plinth/modules/power/views.py b/plinth/modules/power/views.py
index ae18d4506..2c36fb506 100644
--- a/plinth/modules/power/views.py
+++ b/plinth/modules/power/views.py
@@ -20,9 +20,9 @@ Plinth module for power module.
"""
from django.forms import Form
-from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.template.response import TemplateResponse
+from django.urls import reverse
from django.utils.translation import ugettext as _
from plinth import actions
diff --git a/plinth/modules/upgrades/views.py b/plinth/modules/upgrades/views.py
index 857fb2070..f02ff02a5 100644
--- a/plinth/modules/upgrades/views.py
+++ b/plinth/modules/upgrades/views.py
@@ -20,8 +20,8 @@ Plinth module for upgrades
"""
from django.contrib import messages
-from django.core.urlresolvers import reverse_lazy
from django.template.response import TemplateResponse
+from django.urls import reverse_lazy
from django.utils.translation import ugettext as _, ugettext_lazy
from django.views.generic.edit import FormView
import subprocess
diff --git a/plinth/modules/users/urls.py b/plinth/modules/users/urls.py
index 234252e97..bb5d53476 100644
--- a/plinth/modules/users/urls.py
+++ b/plinth/modules/users/urls.py
@@ -21,7 +21,7 @@ URLs for the Users module
from django.conf.urls import url
from django.contrib.auth import views as auth_views
-from django.core.urlresolvers import reverse_lazy
+from django.urls import reverse_lazy
from . import views
diff --git a/plinth/modules/users/views.py b/plinth/modules/users/views.py
index 7e261ea1e..3c56d0412 100644
--- a/plinth/modules/users/views.py
+++ b/plinth/modules/users/views.py
@@ -19,7 +19,7 @@ from django.contrib import messages
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.models import User
from django.contrib.messages.views import SuccessMessageMixin
-from django.core.urlresolvers import reverse, reverse_lazy
+from django.urls import reverse, reverse_lazy
from django.views.generic.edit import (CreateView, DeleteView, UpdateView,
FormView)
from django.views.generic import ListView
diff --git a/plinth/tests/test_menu.py b/plinth/tests/test_menu.py
index be8d0024d..d19d89b9e 100644
--- a/plinth/tests/test_menu.py
+++ b/plinth/tests/test_menu.py
@@ -19,9 +19,9 @@
Test module for menus.
"""
-from django.core.urlresolvers import reverse
from django.http import HttpRequest
from django.test import TestCase
+from django.urls import reverse
import random
from plinth.menu import Menu
diff --git a/plinth/tests/test_middleware.py b/plinth/tests/test_middleware.py
index eef329a57..4663385ba 100644
--- a/plinth/tests/test_middleware.py
+++ b/plinth/tests/test_middleware.py
@@ -67,7 +67,7 @@ class TestSetupMiddleware(TestCase):
self.assertEqual(response, None)
@patch('plinth.module_loader.loaded_modules')
- @patch('django.core.urlresolvers.resolve')
+ @patch('django.urls.resolve')
def test_module_is_up_to_date(self, resolve, loaded_modules):
"""Test that none is returned when module is up-to-date."""
resolve.return_value.namespaces = ['mockapp']
@@ -84,7 +84,7 @@ class TestSetupMiddleware(TestCase):
@patch('plinth.views.SetupView')
@patch('plinth.module_loader.loaded_modules')
- @patch('django.core.urlresolvers.resolve')
+ @patch('django.urls.resolve')
def test_module_view(self, resolve, loaded_modules, setup_view):
"""Test that setup view is returned."""
resolve.return_value.namespaces = ['mockapp']
@@ -102,7 +102,7 @@ class TestSetupMiddleware(TestCase):
@patch('django.contrib.messages.success')
@patch('plinth.module_loader.loaded_modules')
- @patch('django.core.urlresolvers.resolve')
+ @patch('django.urls.resolve')
def test_install_result_collection(self, resolve, loaded_modules,
messages_success):
"""Test that module installation result is collected properly."""
diff --git a/plinth/views.py b/plinth/views.py
index 8bdd1b84f..2c403afca 100644
--- a/plinth/views.py
+++ b/plinth/views.py
@@ -21,10 +21,10 @@ Main Plinth views
from django.contrib import messages
from django.core.exceptions import ImproperlyConfigured
-from django.core.urlresolvers import reverse
from django.http.response import HttpResponseRedirect
from django.views.generic import TemplateView
from django.views.generic.edit import FormView
+from django.urls import reverse
from django.utils.translation import ugettext as _
import time